Search in sources :

Example 26 with DERSequence

use of org.bouncycastle.asn1.DERSequence in project robovm by robovm.

the class Extensions method toASN1Primitive.

/**
     * <pre>
     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
     *
     *     Extension         ::=   SEQUENCE {
     *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
     *        critical          BOOLEAN DEFAULT FALSE,
     *        extnValue         OCTET STRING }
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = ordering.elements();
    while (e.hasMoreElements()) {
        ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e.nextElement();
        Extension ext = (Extension) extensions.get(oid);
        vec.add(ext);
    }
    return new DERSequence(vec);
}
Also used : Enumeration(java.util.Enumeration) DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 27 with DERSequence

use of org.bouncycastle.asn1.DERSequence in project robovm by robovm.

the class CertificationRequestInfo method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(version);
    v.add(subject);
    v.add(subjectPKInfo);
    if (attributes != null) {
        v.add(new DERTaggedObject(false, 0, attributes));
    }
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 28 with DERSequence

use of org.bouncycastle.asn1.DERSequence in project robovm by robovm.

the class EncryptedPrivateKeyInfo method toASN1Primitive.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * <pre>
     * EncryptedPrivateKeyInfo ::= SEQUENCE {
     *      encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
     *      encryptedData EncryptedData
     * }
     *
     * EncryptedData ::= OCTET STRING
     *
     * KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
     *          ... -- For local profiles
     * }
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(algId);
    v.add(data);
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 29 with DERSequence

use of org.bouncycastle.asn1.DERSequence in project robovm by robovm.

the class IssuerAndSerialNumber method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(name);
    v.add(certSerialNumber);
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 30 with DERSequence

use of org.bouncycastle.asn1.DERSequence in project robovm by robovm.

the class PBES2Algorithms method getASN1Primitive.

public ASN1Primitive getASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    ASN1EncodableVector subV = new ASN1EncodableVector();
    v.add(objectId);
    subV.add(func);
    subV.add(scheme);
    v.add(new DERSequence(subV));
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Aggregations

DERSequence (org.bouncycastle.asn1.DERSequence)118 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)111 DERTaggedObject (org.bouncycastle.asn1.DERTaggedObject)17 DERBitString (org.bouncycastle.asn1.DERBitString)13 DEROctetString (org.bouncycastle.asn1.DEROctetString)13 IOException (java.io.IOException)12 X509Certificate (java.security.cert.X509Certificate)11 Enumeration (java.util.Enumeration)10 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)9 DERInteger (org.bouncycastle.asn1.DERInteger)9 GeneralName (org.bouncycastle.asn1.x509.GeneralName)9 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)8 BigInteger (java.math.BigInteger)7 List (java.util.List)7 DERIA5String (org.bouncycastle.asn1.DERIA5String)7 PrivateKey (java.security.PrivateKey)6 DERObjectIdentifier (org.bouncycastle.asn1.DERObjectIdentifier)6 ASN1EncodableVector (com.android.org.bouncycastle.asn1.ASN1EncodableVector)5 ASN1InputStream (com.android.org.bouncycastle.asn1.ASN1InputStream)5 ASN1Integer (com.android.org.bouncycastle.asn1.ASN1Integer)5