FileDocCategorySizeDatePackage
X509Extensions.javaAPI DocAzureus 3.0.3.48804Tue Jun 08 05:12:56 BST 2004org.bouncycastle.asn1.x509

X509Extensions

public class X509Extensions extends Object implements org.bouncycastle.asn1.DEREncodable

Fields Summary
public static final org.bouncycastle.asn1.DERObjectIdentifier
SubjectKeyIdentifier
Subject Key Identifier
public static final org.bouncycastle.asn1.DERObjectIdentifier
KeyUsage
Key Usage
public static final org.bouncycastle.asn1.DERObjectIdentifier
PrivateKeyUsagePeriod
Private Key Usage Period
public static final org.bouncycastle.asn1.DERObjectIdentifier
SubjectAlternativeName
Subject Alternative Name
public static final org.bouncycastle.asn1.DERObjectIdentifier
IssuerAlternativeName
Issuer Alternative Name
public static final org.bouncycastle.asn1.DERObjectIdentifier
BasicConstraints
Basic Constraints
public static final org.bouncycastle.asn1.DERObjectIdentifier
CRLNumber
CRL Number
public static final org.bouncycastle.asn1.DERObjectIdentifier
ReasonCode
Reason code
public static final org.bouncycastle.asn1.DERObjectIdentifier
InstructionCode
Hold Instruction Code
public static final org.bouncycastle.asn1.DERObjectIdentifier
InvalidityDate
Invalidity Date
public static final org.bouncycastle.asn1.DERObjectIdentifier
DeltaCRLIndicator
Delta CRL indicator
public static final org.bouncycastle.asn1.DERObjectIdentifier
IssuingDistributionPoint
Issuing Distribution Point
public static final org.bouncycastle.asn1.DERObjectIdentifier
CertificateIssuer
Certificate Issuer
public static final org.bouncycastle.asn1.DERObjectIdentifier
NameConstraints
Name Constraints
public static final org.bouncycastle.asn1.DERObjectIdentifier
CRLDistributionPoints
CRL Distribution Points
public static final org.bouncycastle.asn1.DERObjectIdentifier
CertificatePolicies
Certificate Policies
public static final org.bouncycastle.asn1.DERObjectIdentifier
PolicyMappings
Policy Mappings
public static final org.bouncycastle.asn1.DERObjectIdentifier
AuthorityKeyIdentifier
Authority Key Identifier
public static final org.bouncycastle.asn1.DERObjectIdentifier
PolicyConstraints
Policy Constraints
public static final org.bouncycastle.asn1.DERObjectIdentifier
ExtendedKeyUsage
Extended Key Usage
public static final org.bouncycastle.asn1.DERObjectIdentifier
InhibitAnyPolicy
Inhibit Any Policy
public static final org.bouncycastle.asn1.DERObjectIdentifier
AuthorityInfoAccess
Authority Info Access
private Hashtable
extensions
private Vector
ordering
Constructors Summary
public X509Extensions(org.bouncycastle.asn1.ASN1Sequence seq)
Constructor from ASN1Sequence. the extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)

        Enumeration e = seq.getObjects();

        while (e.hasMoreElements())
        {
            ASN1Sequence            s = (ASN1Sequence)e.nextElement();

            if (s.size() == 3)
            {
                extensions.put(s.getObjectAt(0), new X509Extension((DERBoolean)s.getObjectAt(1), (ASN1OctetString)s.getObjectAt(2)));
            }
            else
            {
                extensions.put(s.getObjectAt(0), new X509Extension(false, (ASN1OctetString)s.getObjectAt(1)));
            }

            ordering.addElement(s.getObjectAt(0));
        }
    
public X509Extensions(Hashtable extensions)
constructor from a table of extensions.

it's is assumed the table contains OID/String pairs.

        this(null, extensions);
    
public X509Extensions(Vector ordering, Hashtable extensions)
Constructor from a table of extensions with ordering.

It's is assumed the table contains OID/String pairs.

        Enumeration e;

        if (ordering == null)
        {
            e = extensions.keys();
        }
        else
        {
            e = ordering.elements();
        }

        while (e.hasMoreElements())
        {
            this.ordering.addElement(e.nextElement()); 
        }

        e = this.ordering.elements();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
            X509Extension           ext = (X509Extension)extensions.get(oid);

            this.extensions.put(oid, ext);
        }
    
Methods Summary
public booleanequals(java.lang.Object o)

        if (o == null || !(o instanceof X509Extensions))
        {
            return false;
        }

        X509Extensions  other = (X509Extensions)o;

        Enumeration     e1 = extensions.keys();
        Enumeration     e2 = other.extensions.keys();

        while (e1.hasMoreElements() && e2.hasMoreElements())
        {
            Object  o1 = e1.nextElement();
            Object  o2 = e2.nextElement();
            
            if (!o1.equals(o2))
            {
                return false;
            }
        }

        if (e1.hasMoreElements() || e2.hasMoreElements())
        {
            return false;
        }

        return true;
    
public org.bouncycastle.asn1.DERObjectgetDERObject()

        ASN1EncodableVector     vec = new ASN1EncodableVector();
        Enumeration             e = ordering.elements();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
            X509Extension           ext = (X509Extension)extensions.get(oid);
            ASN1EncodableVector     v = new ASN1EncodableVector();

            v.add(oid);

            if (ext.isCritical())
            {
                v.add(new DERBoolean(true));
            }

            v.add(ext.getValue());

            vec.add(new DERSequence(v));
        }

        return new DERSequence(vec);
    
public X509ExtensiongetExtension(org.bouncycastle.asn1.DERObjectIdentifier oid)
return the extension represented by the object identifier passed in.

return
the extension if it's present, null otherwise.

        return (X509Extension)extensions.get(oid);
    
public static org.bouncycastle.asn1.x509.X509ExtensionsgetInstance(org.bouncycastle.asn1.ASN1TaggedObject obj, boolean explicit)


       
         
                  
    
        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    
public static org.bouncycastle.asn1.x509.X509ExtensionsgetInstance(java.lang.Object obj)

        if (obj == null || obj instanceof X509Extensions)
        {
            return (X509Extensions)obj;
        }

        if (obj instanceof ASN1Sequence)
        {
            return new X509Extensions((ASN1Sequence)obj);
        }

        if (obj instanceof ASN1TaggedObject)
        {
            return getInstance(((ASN1TaggedObject)obj).getObject());
        }

        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
    
public inthashCode()

        Enumeration     e = extensions.keys();
        int             hashCode = 0;

        while (e.hasMoreElements())
        {
            Object  o = e.nextElement();

            hashCode ^= o.hashCode();
            hashCode ^= extensions.get(o).hashCode();
        }

        return hashCode;
    
public java.util.Enumerationoids()
return an Enumeration of the extension field's object ids.

        return ordering.elements();