FileDocCategorySizeDatePackage
CertificatePolicies.javaAPI DocAndroid 1.5 API3924Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.x509

CertificatePolicies

public class CertificatePolicies extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
static final org.bouncycastle.asn1.DERObjectIdentifier
anyPolicy
Vector
policies
Constructors Summary
public CertificatePolicies(org.bouncycastle.asn1.ASN1Sequence seq)

deprecated
use an ASN1Sequence of PolicyInformation

        Enumeration e = seq.getObjects();
        while (e.hasMoreElements())
        {
            ASN1Sequence s = ASN1Sequence.getInstance(e.nextElement());
            policies.addElement(s.getObjectAt(0));
        }
        // For now we just don't handle PolicyQualifiers
    
public CertificatePolicies(org.bouncycastle.asn1.DERObjectIdentifier p)
create a certificate policy with the given OID.

deprecated
use an ASN1Sequence of PolicyInformation

        policies.addElement(p);
    
public CertificatePolicies(String p)
create a certificate policy with the policy given by the OID represented by the string p.

deprecated
use an ASN1Sequence of PolicyInformation

        this(new DERObjectIdentifier(p));
    
Methods Summary
public voidaddPolicy(java.lang.String p)

        policies.addElement(new DERObjectIdentifier(p));
    
public static org.bouncycastle.asn1.x509.CertificatePoliciesgetInstance(org.bouncycastle.asn1.ASN1TaggedObject obj, boolean explicit)

deprecated
use an ASN1Sequence of PolicyInformation


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

deprecated
use an ASN1Sequence of PolicyInformation

        if (obj instanceof CertificatePolicies)
        {
            return (CertificatePolicies)obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new CertificatePolicies((ASN1Sequence)obj);
        }

        throw new IllegalArgumentException("unknown object in factory");
    
public java.lang.StringgetPolicy(int nr)

        if (policies.size() > nr)
        {
            return ((DERObjectIdentifier)policies.elementAt(nr)).getId();
        }
        
        return null;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation

PolicyInformation ::= SEQUENCE {
policyIdentifier CertPolicyId,
policyQualifiers SEQUENCE SIZE (1..MAX) OF
PolicyQualifierInfo OPTIONAL }

CertPolicyId ::= OBJECT IDENTIFIER

PolicyQualifierInfo ::= SEQUENCE {
policyQualifierId PolicyQualifierId,
qualifier ANY DEFINED BY policyQualifierId }

PolicyQualifierId ::=
OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)

deprecated
use an ASN1Sequence of PolicyInformation

        ASN1EncodableVector  v = new ASN1EncodableVector();

        // We only do policyIdentifier yet...
        for (int i=0;i<policies.size();i++)
        {
            v.add(new DERSequence((DERObjectIdentifier)policies.elementAt(i)));
        }

        return new DERSequence(v);
    
public java.lang.StringtoString()

        String p = null;
        for (int i=0;i<policies.size();i++)
        {
            if (p != null)
            {
                p += ", ";
            }
            p += ((DERObjectIdentifier)policies.elementAt(i)).getId();
        }
        return "CertificatePolicies: "+p;