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:
- java.io.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.
- Version:
- 1.0
- Author:
- Karl Scheibelhofer
- See Also:
- Serialized Form
Field Summary |
protected static java.lang.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 java.util.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. |
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. |
java.lang.String |
getMessage()
This method gets the corresponding text error message from
a property file. |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ERROR_CODE_PROPERTIES
protected static final java.lang.String ERROR_CODE_PROPERTIES
- The name of the properties file that holds the names of the PKCS#11 error-
codes.
errorCodeNames_
protected static java.util.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.
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).
getMessage
public java.lang.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.
- Overrides:
getMessage
in class java.lang.Throwable
- Returns:
- The message or the error code; e.g. "CKR_DEVICE_ERROR" or
"0x00000030".
getErrorCode
public long getErrorCode()
- Returns the PKCS#11 error code.
- Returns:
- The error code; e.g. 0x00000030.
IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.2.18