Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## iaik.pkcs.pkcs11.wrapper
Class PKCS11Exception

    java.lang.Object
      java.lang.Throwable
          java.lang.Exception
              iaik.pkcs.pkcs11.TokenException
                  iaik.pkcs.pkcs11.wrapper.PKCS11Exception

All Implemented Interfaces:
  Serializable

public class PKCS11Exception
extends TokenException

This is the superclass of all checked exceptions used by this package. An exception of this class indicates that a function call to the underlying PKCS#11 module returned a value not equal to CKR_OK. The application can get the returned value by calling getErrorCode(). A return value not equal to CKR_OK is the only reason for such an exception to be thrown. PKCS#11 defines the meaning of an error-code, which may depend on the context in which the error occurs.

See Also:
  Serialized Form
Invariants

Field Summary
`protected static String` | `ERROR_CODE_PROPERTIES` The name of the properties file that holds the names of the PKCS#11 error- codes.
`protected long` | `errorCode_` The code of the error which was the reason for this exception.
`protected static Properties` | `errorCodeNames_` The properties object that holds the mapping from error-code to the name of the PKCS#11 error.
`protected static boolean` | `errorCodeNamesAvailable_` True, if the mapping of error codes to PKCS#11 error names is available.

Fields inherited from class iaik.pkcs.pkcs11.TokenException
`encapsulatedException_`

Constructor Summary
`PKCS11Exception(long errorCode)` Constructor taking the error code as defined for the CKR_* constants in PKCS#11.

Method Summary
`long` | `getErrorCode()` Returns the PKCS#11 error code.
`String` | `getMessage()` This method gets the corresponding text error message from a property file.

Methods inherited from class iaik.pkcs.pkcs11.TokenException
`getEncapsulatedException, toString`

Methods inherited from class java.lang.Throwable
`fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ERROR_CODE_PROPERTIES

    protected static final String ERROR_CODE_PROPERTIES

  The name of the properties file that holds the names of the PKCS#11 error- codes.

  See Also:
    Constant Field Values

### errorCodeNames_

    protected static Properties errorCodeNames_

  The properties object that holds the mapping from error-code to the name of the PKCS#11 error.

### errorCodeNamesAvailable_

    protected static boolean errorCodeNamesAvailable_

  True, if the mapping of error codes to PKCS#11 error names is available.

### errorCode_

    protected long errorCode_

  The code of the error which was the reason for this exception.

Constructor Detail

### PKCS11Exception

    public PKCS11Exception(long errorCode)

  Constructor taking the error code as defined for the CKR_* constants in PKCS#11.

Parameters:
  `errorCode` - The PKCS#11 error code (return value).

Method Detail

### getMessage

    public String getMessage()

  This method gets the corresponding text error message from a property file. If this file is not available, it returns the error code as a hex-string.

  Returns:
    The message or the error code; e.g. "CKR_DEVICE_ERROR" or "0x00000030".
  Preconditions
  Postconditions
    (result <> null)

### getErrorCode

    public long getErrorCode()

  Returns the PKCS#11 error code.

  Returns:
    The error code; e.g. 0x00000030.
  Preconditions
  Postconditions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2002, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.