|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.4.2
java.security.cert
|
Method Summary | |
Set |
getCriticalExtensionOIDs()
Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. |
byte[] |
getExtensionValue(String oid)
Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid
String. |
Set |
getNonCriticalExtensionOIDs()
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. |
boolean |
hasUnsupportedCriticalExtension()
Check if there is a critical extension that is not supported. |
Method Detail |
public boolean hasUnsupportedCriticalExtension()
public Set getCriticalExtensionOIDs()
InputStream inStrm = new FileInputStream("DER-encoded-Cert");
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate)cf.generateCertificate(inStrm);
inStrm.close();
Set critSet = cert.getCriticalExtensionOIDs();
if (critSet != null && !critSet.isEmpty()) {
System.out.println("Set of critical extensions:");
for (Iterator i = critSet.iterator(); i.hasNext();) {
String oid = (String)i.next();
System.out.println(oid);
}
}
public Set getNonCriticalExtensionOIDs()
InputStream inStrm = new FileInputStream("DER-encoded-CRL");
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509CRL crl = (X509CRL)cf.generateCRL(inStrm);
inStrm.close();
byte[] certData = <DER-encoded certificate data>
ByteArrayInputStream bais = new ByteArrayInputStream(certData);
X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
bais.close();
X509CRLEntry badCert =
crl.getRevokedCertificate(cert.getSerialNumber());
if (badCert != null) {
Set nonCritSet = badCert.getNonCriticalExtensionOIDs();
if (nonCritSet != null)
for (Iterator i = nonCritSet.iterator(); i.hasNext();) {
String oid = (String)i.next();
System.out.println(oid);
}
}
public byte[] getExtensionValue(String oid)
oid
String.
The oid
string is
represented by a set of nonnegative whole numbers separated
by periods.
For example:
OID (Object Identifier) | Extension Name |
---|---|
2.5.29.14 | SubjectKeyIdentifier |
2.5.29.15 | KeyUsage |
2.5.29.16 | PrivateKeyUsage |
2.5.29.17 | SubjectAlternativeName |
2.5.29.18 | IssuerAlternativeName |
2.5.29.19 | BasicConstraints |
2.5.29.30 | NameConstraints |
2.5.29.33 | PolicyMappings |
2.5.29.35 | AuthorityKeyIdentifier |
2.5.29.36 | PolicyConstraints |
oid
- the Object Identifier value for the extension.