Example usage for org.bouncycastle.asn1.x509 X509Name getInstance

List of usage examples for org.bouncycastle.asn1.x509 X509Name getInstance

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 X509Name getInstance.

Prototype

public static X509Name getInstance(ASN1TaggedObject obj, boolean explicit) 

Source Link

Document

Return a X509Name based on the passed in tagged object.

Usage

From source file:com.novosec.pkix.asn1.crmf.CertTemplate.java

License:Open Source License

public CertTemplate(ASN1Sequence seq) {
    Enumeration e = (seq == null ? null : seq.getObjects());
    while (e != null && e.hasMoreElements()) {
        DERTaggedObject obj = (DERTaggedObject) e.nextElement();
        int tagno = (obj == null ? -1 : obj.getTagNo());
        switch (tagno) {
        case 0:/*from   www. j a  v a 2s. c  o  m*/
            this.version = DERInteger.getInstance(obj, false);
            break;
        case 1:
            this.serialNumber = DERInteger.getInstance(obj, false);
            break;
        case 2:
            this.signingAlg = AlgorithmIdentifier.getInstance(obj, false);
            break;
        case 3:
            this.issuer = X509Name.getInstance(obj, bNameIsExplicit);
            break;
        case 4:
            this.validity = OptionalValidity.getInstance(obj, false);
            break;
        case 5:
            this.subject = X509Name.getInstance(obj, bNameIsExplicit);
            break;
        case 6:
            this.publicKey = SubjectPublicKeyInfo.getInstance(obj, false);
            break;
        case 7:
            this.issuerUID = DERBitString.getInstance(obj, false);
            break;
        case 8:
            this.subjectUID = DERBitString.getInstance(obj, false);
            break;
        case 9:
            this.extensions = X509Extensions.getInstance(obj, false);
            break;
        default:
            throw new IllegalArgumentException("invalid asn1 sequence");
        }
    }
}