FileDocCategorySizeDatePackage
CMSMessageSignatureServiceException.javaAPI DocphoneME MR2 API (J2ME)4124Wed May 02 18:00:40 BST 2007javax.microedition.securityservice

CMSMessageSignatureServiceException

public final class CMSMessageSignatureServiceException extends Exception
This class is used to identify error conditions detected while signing messages. Thrown by the CMSMessageSignatureService and UserCredentialManager classes.

Fields Summary
public static final byte
CRYPTO_FAILURE
Error code returned if a cyptographic error occured.
public static final byte
CRYPTO_FORMAT_ERROR
Error code returned if an error occurs when formatting a result.
public static final byte
CRYPTO_NO_DETACHED_SIG
Error code returned if detached signatures are not supported.
public static final byte
CRYPTO_NO_OPAQUE_SIG
Error code returned if opaque signatures are not supported.
public static final byte
SE_BUSY
Error code returned if security element is busy.
public static final byte
SE_FAILURE
Error code returned if an operation involving the security element fails.
public static final byte
SE_CRYPTO_FAILURE
Error code returned if a cryptographic operation failed in a security element.
public static final byte
CRYPTO_NO_CERTIFICATE
Error code returned if a certificate is not available on the device for the selected public key.
private byte
reasonCode
The reason code for exception.
Constructors Summary
public CMSMessageSignatureServiceException(byte code)
Construct an exception with specific reason code.

param
code the code for the error condition


                         
       
        super(getMessageForReason(code));
	reasonCode = code;
    
Methods Summary
static java.lang.StringgetMessageForReason(int reason)
Gets the exception message for a reason.

param
reason reason code
return
exception message

        switch (reason) {
        case CRYPTO_FAILURE:
            return "Failed to perform cryptographic function";

        case CRYPTO_FORMAT_ERROR:
            return "Formatting error during cryptographic processing";

        case CRYPTO_NO_DETACHED_SIG:
            return "Detached signatures not supported";

        case CRYPTO_NO_OPAQUE_SIG:
            return "Opaque signatures not supported";

        case SE_BUSY:
            return "Security element is busy";

        case SE_FAILURE:
            return "Security element failure";

        case SE_CRYPTO_FAILURE:
            return "Security element failed cryptographic request";

        case CRYPTO_NO_CERTIFICATE:
            return "Certificate was not found for cryptographic operation";
        }

        return "Unknown reason (" + reason + ")";
    
public bytegetReason()
Gets the reason code.

return
the reason code for the error detected

        return reasonCode;