CertificateException (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.microedition.pki
Class CertificateException

    java.lang.Object
      java.lang.Throwable
          java.lang.Exception
              java.io.IOException
                  javax.microedition.pki.CertificateException

    @TransactionType(value=NOT_SUPPORTED)
    public class CertificateException

extends IOException

The `CertificateException` encapsulates an error that occurred while a `Certificate` is being used. If multiple errors are found within a `Certificate` the more significant error should be reported in the exception.

Direct instances of this exception class are not bound to any context and can be passed between contexts without any restrictions. Objects created and returned by the methods of this class are owned by the caller. In particular, a call to the `Throwable.getMessage()` returns a String instance bound to the owner context of the caller.

See Runtime Environment Specification for the Java Card Platform, Connected Edition, chapter 7 for details regarding transfer of ownership.

Since:
  MIDP 2.0

Field Summary
`static byte` | `BAD_EXTENSIONS` Indicates a certificate has unrecognized critical extensions.
`static byte` | `BROKEN_CHAIN` Indicates a certificate in a chain was not issued by the next authority in the chain.
`static byte` | `CERTIFICATE_CHAIN_TOO_LONG` Indicates the server certificate chain exceeds the length allowed by an issuer's policy.
`static byte` | `EXPIRED` Indicates a certificate is expired.
`static byte` | `INAPPROPRIATE_KEY_USAGE` Indicates a certificate public key has been used in way deemed inappropriate by the issuer.
`static byte` | `MISSING_SIGNATURE` Indicates a certificate object does not contain a signature.
`static byte` | `NOT_YET_VALID` Indicates a certificate is not yet valid.
`static byte` | `ROOT_CA_EXPIRED` Indicates the root CA's public key is expired.
`static byte` | `SITENAME_MISMATCH` Indicates a certificate does not contain the correct site name.
`static byte` | `UNAUTHORIZED_INTERMEDIATE_CA` Indicates an intermediate certificate in the chain does not have the authority to be a intermediate CA.
`static byte` | `UNRECOGNIZED_ISSUER` Indicates a certificate was issued by an unrecognized entity.
`static byte` | `UNSUPPORTED_PUBLIC_KEY_TYPE` Indicates that type of the public key in a certificate is not supported by the device.
`static byte` | `UNSUPPORTED_SIGALG` Indicates a certificate was signed using an unsupported algorithm.
`static byte` | `VERIFICATION_FAILED` Indicates a certificate failed verification.

Constructor Summary
`CertificateException(Certificate certificate, byte status)` Create a new exception with a `Certificate` and specific error reason.
`CertificateException(String message, Certificate certificate, byte status)` Create a new exception with a message, `Certificate`, and specific error reason.

Method Summary
`Certificate` | `getCertificate()` Get the `Certificate` that caused the exception.
`byte` | `getReason()` Get the reason code.

Methods inherited from class java.lang.Throwable
`getMessage, printStackTrace, toString`

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

Field Detail

### BAD_EXTENSIONS

    public static final byte BAD_EXTENSIONS

  Indicates a certificate has unrecognized critical extensions. The value is 1.

  See Also:
    Constant Field Values

### CERTIFICATE_CHAIN_TOO_LONG

    public static final byte CERTIFICATE_CHAIN_TOO_LONG

  Indicates the server certificate chain exceeds the length allowed by an issuer's policy. The value is 2.

  See Also:
    Constant Field Values

### EXPIRED

    public static final byte EXPIRED

  Indicates a certificate is expired. The value is 3.

  See Also:
    Constant Field Values

### UNAUTHORIZED_INTERMEDIATE_CA

    public static final byte UNAUTHORIZED_INTERMEDIATE_CA

  Indicates an intermediate certificate in the chain does not have the authority to be a intermediate CA. The value is 4.

  See Also:
    Constant Field Values

### MISSING_SIGNATURE

    public static final byte MISSING_SIGNATURE

  Indicates a certificate object does not contain a signature. The value is 5.

  See Also:
    Constant Field Values

### NOT_YET_VALID

    public static final byte NOT_YET_VALID

  Indicates a certificate is not yet valid. The value is 6.

  See Also:
    Constant Field Values

### SITENAME_MISMATCH

    public static final byte SITENAME_MISMATCH

  Indicates a certificate does not contain the correct site name. The value is 7.

  See Also:
    Constant Field Values

### UNRECOGNIZED_ISSUER

    public static final byte UNRECOGNIZED_ISSUER

  Indicates a certificate was issued by an unrecognized entity. The value is 8.

  See Also:
    Constant Field Values

### UNSUPPORTED_SIGALG

    public static final byte UNSUPPORTED_SIGALG

  Indicates a certificate was signed using an unsupported algorithm. The value is 9.

  See Also:
    Constant Field Values

### INAPPROPRIATE_KEY_USAGE

    public static final byte INAPPROPRIATE_KEY_USAGE

  Indicates a certificate public key has been used in way deemed inappropriate by the issuer. The value is 10.

  See Also:
    Constant Field Values

### BROKEN_CHAIN

    public static final byte BROKEN_CHAIN

  Indicates a certificate in a chain was not issued by the next authority in the chain. The value is 11.

  See Also:
    Constant Field Values

### ROOT_CA_EXPIRED

    public static final byte ROOT_CA_EXPIRED

  Indicates the root CA's public key is expired. The value is 12.

  See Also:
    Constant Field Values

### UNSUPPORTED_PUBLIC_KEY_TYPE

    public static final byte UNSUPPORTED_PUBLIC_KEY_TYPE

  Indicates that type of the public key in a certificate is not supported by the device. The value is 13.

  See Also:
    Constant Field Values

### VERIFICATION_FAILED

    public static final byte VERIFICATION_FAILED

  Indicates a certificate failed verification. The value is 14.

  See Also:
    Constant Field Values

Constructor Detail

### CertificateException

    public CertificateException(Certificate certificate,
                                byte status)

  Create a new exception with a `Certificate` and specific error reason. The descriptive message for the new exception will be automatically provided, based on the reason.

  Parameters:
    `certificate` - the certificate that caused the exception
    `status` - the reason for the exception; the status MUST be between BAD_EXTENSIONS and VERIFICATION_FAILED inclusive.

### CertificateException

    public CertificateException(String message,
                                Certificate certificate,
                                byte status)

  Create a new exception with a message, `Certificate`, and specific error reason.

  Parameters:
    `message` - a descriptive message
    `certificate` - the certificate that caused the exception
    `status` - the reason for the exception; the status MUST be between BAD_EXTENSIONS and VERIFICATION_FAILED inclusive.

Method Detail

### getCertificate

    public Certificate getCertificate()

  Get the `Certificate` that caused the exception.

  Returns:
    the `Certificate` that included the failure.

### getReason

    public byte getReason()

  Get the reason code.

  Returns:
    the reason code

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.