Search in sources :

Example 26 with X509Extension

use of org.gudy.bouncycastle.asn1.x509.X509Extension 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 27 with X509Extension

use of org.gudy.bouncycastle.asn1.x509.X509Extension 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)14 IOException (java.io.IOException)11 X509Extension (org.gudy.bouncycastle.asn1.x509.X509Extension)11 DERObjectIdentifier (org.bouncycastle.asn1.DERObjectIdentifier)10 X509Extension (org.bouncycastle.asn1.x509.X509Extension)10 X509Extensions (org.bouncycastle.asn1.x509.X509Extensions)10 HashSet (java.util.HashSet)8 Set (java.util.Set)6 X509Extensions (org.gudy.bouncycastle.asn1.x509.X509Extensions)6 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)5 CertificateExpiredException (java.security.cert.CertificateExpiredException)4 CertificateNotYetValidException (java.security.cert.CertificateNotYetValidException)4 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)4 DERSequence (org.bouncycastle.asn1.DERSequence)4 DERObjectIdentifier (org.gudy.bouncycastle.asn1.DERObjectIdentifier)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 GeneralSecurityException (java.security.GeneralSecurityException)3 CRLException (java.security.cert.CRLException)3 ArrayList (java.util.ArrayList)3 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)3