The extensions defined for X.509 v3
Certificates
and v2
CRLs
(Certificate Revocation
Lists) provide methods
for associating additional attributes with users or public keys,
for managing the certification hierarchy, and for managing CRL
distribution. The X.509 extensions format also allows communities
to define private extensions to carry information unique to those
communities.
Each extension in a certificate/CRL may be designated as critical or non-critical. A certificate/CRL-using system (an application validating a certificate/CRL) must reject the certificate/CRL if it encounters a critical extension it does not recognize. A non-critical extension may be ignored if it is not recognized.
The ASN.1 definition for this is:
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension Extension ::= SEQUENCE { extnId OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING -- contains a DER encoding of a value -- of the type registered for use with -- the extnId object identifier value }Since not all extensions are known, the
getExtensionValue
method returns the DER-encoded OCTET STRING of the
extension value (i.e., the extnValue
). This can then
be handled by a Class that understands the extension.
Modifier and Type | Method and Description |
---|---|
public Set | Returns: a Set (or an empty Set if none are marked critical) of the extension OID strings for extensions that are marked critical. If there are no extensions present at all, then this method returns null.Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. |
public byte[] | Returns: the DER-encoded octet string of the extension value or null if it is not present.the Object Identifier value for the extension. oid)Gets the DER-encoded OCTET string for the extension value
(extnValue) identified by the passed-in |
public Set | Returns: a Set (or an empty Set if none are marked non-critical) of the extension OID strings for extensions that are marked non-critical. If there are no extensions present at all, then this method returns null.Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. |
public boolean | Returns: true if a critical extension is found that is
not supported, otherwise false .Check if there is a critical extension that is not supported. |
getCriticalExtensionOIDs | back to summary |
---|---|
public Set Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of critical extensions from an X509Certificate and print the OIDs:
|
getExtensionValue | back to summary | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public byte[] getExtensionValue(String oid) Gets the DER-encoded OCTET string for the extension value
(extnValue) identified by the passed-in For example:
|
getNonCriticalExtensionOIDs | back to summary |
---|---|
public Set Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of non-critical extensions from an X509CRL revoked certificate entry and print the OIDs:
|
hasUnsupportedCriticalExtension | back to summary |
---|---|
public boolean hasUnsupportedCriticalExtension() Check if there is a critical extension that is not supported.
|