sun.security.x509
Class CRLReasonCodeExtension

java.lang.Object
  extended by sun.security.x509.Extension
      extended by sun.security.x509.CRLReasonCodeExtension
All Implemented Interfaces:
CertAttrSet

public class CRLReasonCodeExtension
extends Extension
implements CertAttrSet

The reasonCode is a non-critical CRL entry extension that identifies the reason for the certificate revocation. CAs are strongly encouraged to include reason codes in CRL entries; however, the reason code CRL entry extension should be absent instead of using the unspecified (0) reasonCode value.

The ASN.1 syntax for this is:

  id-ce-cRLReason OBJECT IDENTIFIER ::= { id-ce 21 }

  -- reasonCode ::= { CRLReason }

 CRLReason ::= ENUMERATED {
    unspecified             (0),
    keyCompromise           (1),
    cACompromise            (2),
    affiliationChanged      (3),
    superseded              (4),
    cessationOfOperation    (5),
    certificateHold         (6),
    removeFromCRL           (8),
    privilegeWithdrawn      (9),
    aACompromise           (10) }
 

See Also:
Extension, CertAttrSet

Field Summary
static int AA_COMPROMISE
           
static int AFFLIATION_CHANGED
           
static int CA_COMPROMISE
           
static int CERTIFICATE_HOLD
           
static int CESSATION_OF_OPERATION
           
static int KEY_COMPROMISE
           
static String NAME
          Attribute name and Reason codes
static int PRIVILEGE_WITHDRAWN
           
static String REASON
           
static int REMOVE_FROM_CRL
           
static int SUPERSEDED
           
static int UNSPECIFIED
           
 
Fields inherited from class sun.security.x509.Extension
critical, extensionId, extensionValue
 
Constructor Summary
CRLReasonCodeExtension(boolean critical, int reason)
          Create a CRLReasonCodeExtension with the passed in reason.
CRLReasonCodeExtension(Boolean critical, Object value)
          Create the extension from the passed DER encoded value of the same.
CRLReasonCodeExtension(int reason)
          Create a CRLReasonCodeExtension with the passed in reason.
 
Method Summary
 void decode(InputStream in)
          Decode the extension from the InputStream - not just the value but the OID, criticality and the extension value.
 void delete(String name)
          Delete the attribute value.
 void encode(OutputStream out)
          Write the extension to the DerOutputStream.
 Object get(String name)
          Get the attribute value.
 Enumeration getElements()
          Return an enumeration of names of attributes existing within this attribute.
 String getName()
          Return the name of this attribute.
 void set(String name, Object obj)
          Set the attribute value.
 String toString()
          Returns a printable representation of the Reason code.
 
Methods inherited from class sun.security.x509.Extension
encode, equals, getExtensionId, getExtensionValue, hashCode, isCritical
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
Attribute name and Reason codes

See Also:
Constant Field Values

REASON

public static final String REASON
See Also:
Constant Field Values

UNSPECIFIED

public static final int UNSPECIFIED
See Also:
Constant Field Values

KEY_COMPROMISE

public static final int KEY_COMPROMISE
See Also:
Constant Field Values

CA_COMPROMISE

public static final int CA_COMPROMISE
See Also:
Constant Field Values

AFFLIATION_CHANGED

public static final int AFFLIATION_CHANGED
See Also:
Constant Field Values

SUPERSEDED

public static final int SUPERSEDED
See Also:
Constant Field Values

CESSATION_OF_OPERATION

public static final int CESSATION_OF_OPERATION
See Also:
Constant Field Values

CERTIFICATE_HOLD

public static final int CERTIFICATE_HOLD
See Also:
Constant Field Values

REMOVE_FROM_CRL

public static final int REMOVE_FROM_CRL
See Also:
Constant Field Values

PRIVILEGE_WITHDRAWN

public static final int PRIVILEGE_WITHDRAWN
See Also:
Constant Field Values

AA_COMPROMISE

public static final int AA_COMPROMISE
See Also:
Constant Field Values
Constructor Detail

CRLReasonCodeExtension

public CRLReasonCodeExtension(int reason)
                       throws IOException
Create a CRLReasonCodeExtension with the passed in reason. Criticality automatically set to false.

Parameters:
reason - the enumerated value for the reason code.
Throws:
IOException

CRLReasonCodeExtension

public CRLReasonCodeExtension(boolean critical,
                              int reason)
                       throws IOException
Create a CRLReasonCodeExtension with the passed in reason.

Parameters:
critical - true if the extension is to be treated as critical.
reason - the enumerated value for the reason code.
Throws:
IOException

CRLReasonCodeExtension

public CRLReasonCodeExtension(Boolean critical,
                              Object value)
                       throws IOException
Create the extension from the passed DER encoded value of the same.

Parameters:
critical - true if the extension is to be treated as critical.
value - Array of DER encoded bytes of the actual value.
Throws:
IOException - on error.
Method Detail

set

public void set(String name,
                Object obj)
         throws IOException
Set the attribute value.

Specified by:
set in interface CertAttrSet
Parameters:
name - the name of the attribute (e.g. "x509.info.key")
obj - the attribute object.
Throws:
IOException - on other errors.

get

public Object get(String name)
           throws IOException
Get the attribute value.

Specified by:
get in interface CertAttrSet
Parameters:
name - the name of the attribute to return.
Throws:
IOException - on other errors.

delete

public void delete(String name)
            throws IOException
Delete the attribute value.

Specified by:
delete in interface CertAttrSet
Parameters:
name - the name of the attribute to delete.
Throws:
IOException - on other errors.

toString

public String toString()
Returns a printable representation of the Reason code.

Specified by:
toString in interface CertAttrSet
Overrides:
toString in class Extension
Returns:
a string representation of the object.

decode

public void decode(InputStream in)
            throws IOException
Decode the extension from the InputStream - not just the value but the OID, criticality and the extension value.

Specified by:
decode in interface CertAttrSet
Parameters:
in - the InputStream to unmarshal the contents from.
Throws:
IOException - on parsing errors.

encode

public void encode(OutputStream out)
            throws IOException
Write the extension to the DerOutputStream.

Specified by:
encode in interface CertAttrSet
Parameters:
out - the DerOutputStream to write the extension to.
Throws:
IOException - on encoding errors.

getElements

public Enumeration getElements()
Return an enumeration of names of attributes existing within this attribute.

Specified by:
getElements in interface CertAttrSet
Returns:
an enumeration of the attribute names.

getName

public String getName()
Return the name of this attribute.

Specified by:
getName in interface CertAttrSet
Returns:
the name of this CertAttrSet.