Search in sources :

Example 21 with X509Extensions

use of org.gudy.bouncycastle.asn1.x509.X509Extensions in project BiglyBT by BiglySoftware.

the class X509CertificateObject method getCriticalExtensionOIDs.

@Override
public Set getCriticalExtensionOIDs() {
    if (this.getVersion() == 3) {
        HashSet set = new HashSet();
        X509Extensions extensions = c.getTBSCertificate().getExtensions();
        if (extensions != null) {
            Enumeration e = extensions.oids();
            while (e.hasMoreElements()) {
                DERObjectIdentifier oid = (DERObjectIdentifier) e.nextElement();
                X509Extension ext = extensions.getExtension(oid);
                if (ext.isCritical()) {
                    set.add(oid.getId());
                }
            }
            return set;
        }
    }
    return null;
}
Also used : X509Extension(org.gudy.bouncycastle.asn1.x509.X509Extension)

Example 22 with X509Extensions

use of org.gudy.bouncycastle.asn1.x509.X509Extensions in project BiglyBT by BiglySoftware.

the class X509V2AttributeCertificate method getExtensionOIDs.

private Set getExtensionOIDs(boolean critical) {
    X509Extensions extensions = cert.getAcinfo().getExtensions();
    if (extensions != null) {
        Set set = new HashSet();
        Enumeration e = extensions.oids();
        while (e.hasMoreElements()) {
            DERObjectIdentifier oid = (DERObjectIdentifier) e.nextElement();
            X509Extension ext = extensions.getExtension(oid);
            if (ext.isCritical() == critical) {
                set.add(oid.getId());
            }
        }
        return set;
    }
    return null;
}
Also used : X509Extension(org.gudy.bouncycastle.asn1.x509.X509Extension) X509Extensions(org.gudy.bouncycastle.asn1.x509.X509Extensions)

Aggregations

Enumeration (java.util.Enumeration)12 X509Extensions (org.bouncycastle.asn1.x509.X509Extensions)11 X509Extension (org.gudy.bouncycastle.asn1.x509.X509Extension)11 DERObjectIdentifier (org.bouncycastle.asn1.DERObjectIdentifier)10 X509Extension (org.bouncycastle.asn1.x509.X509Extension)10 HashSet (java.util.HashSet)8 IOException (java.io.IOException)7 Set (java.util.Set)6 X509Extensions (org.gudy.bouncycastle.asn1.x509.X509Extensions)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)3 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)3 DERObjectIdentifier (org.gudy.bouncycastle.asn1.DERObjectIdentifier)3 InvalidKeyException (java.security.InvalidKeyException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 NoSuchProviderException (java.security.NoSuchProviderException)2 SignatureException (java.security.SignatureException)2 CRLException (java.security.cert.CRLException)2 CertificateException (java.security.cert.CertificateException)2 CertificateExpiredException (java.security.cert.CertificateExpiredException)2