Search in sources :

Example 26 with ASN1EncodableVector

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

the class CertificateList method toASN1Primitive.

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

Example 27 with ASN1EncodableVector

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

the class DigestInfo method toASN1Primitive.

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

Example 28 with ASN1EncodableVector

use of org.bouncycastle.asn1.ASN1EncodableVector 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 29 with ASN1EncodableVector

use of org.bouncycastle.asn1.ASN1EncodableVector 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 30 with ASN1EncodableVector

use of org.bouncycastle.asn1.ASN1EncodableVector 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)

Aggregations

ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)136 DERSequence (org.bouncycastle.asn1.DERSequence)111 IOException (java.io.IOException)21 DERTaggedObject (org.bouncycastle.asn1.DERTaggedObject)19 ArrayList (java.util.ArrayList)14 X509Certificate (java.security.cert.X509Certificate)12 List (java.util.List)12 BERSequence (org.bouncycastle.asn1.BERSequence)12 Enumeration (java.util.Enumeration)11 ASN1EncodableVector (com.android.org.bouncycastle.asn1.ASN1EncodableVector)10 DERBitString (com.android.org.bouncycastle.asn1.DERBitString)10 DERInteger (org.bouncycastle.asn1.DERInteger)10 DEROctetString (org.bouncycastle.asn1.DEROctetString)9 X500Principal (javax.security.auth.x500.X500Principal)8 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)8 DERBitString (org.bouncycastle.asn1.DERBitString)8 DERSet (org.bouncycastle.asn1.DERSet)8 KeyPair (java.security.KeyPair)7 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)6 PrivateKey (java.security.PrivateKey)5