Search in sources :

Example 71 with DERSequence

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

the class GeneralSubtree method toASN1Primitive.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * 
     * Returns:
     * 
     * <pre>
     *       GeneralSubtree ::= SEQUENCE 
     *       {
     *         base                    GeneralName,
     *         minimum         [0]     BaseDistance DEFAULT 0,
     *         maximum         [1]     BaseDistance OPTIONAL 
     *       }
     * </pre>
     * 
     * @return a ASN1Primitive
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(base);
    if (minimum != null && !minimum.getValue().equals(ZERO)) {
        v.add(new DERTaggedObject(false, 0, minimum));
    }
    if (maximum != null) {
        v.add(new DERTaggedObject(false, 1, maximum));
    }
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 72 with DERSequence

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

the class ObjectDigestInfo method toASN1Primitive.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * 
     * <pre>
     *  
     *    ObjectDigestInfo ::= SEQUENCE {
     *         digestedObjectType  ENUMERATED {
     *                 publicKey            (0),
     *                 publicKeyCert        (1),
     *                 otherObjectTypes     (2) },
     *                         -- otherObjectTypes MUST NOT
     *                         -- be used in this profile
     *         otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
     *         digestAlgorithm     AlgorithmIdentifier,
     *         objectDigest        BIT STRING
     *    }
     *   
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(digestedObjectType);
    if (otherObjectTypeID != null) {
        v.add(otherObjectTypeID);
    }
    v.add(digestAlgorithm);
    v.add(objectDigest);
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 73 with DERSequence

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

the class RSAPublicKeyStructure method toASN1Primitive.

/**
     * This outputs the key in PKCS1v2 format.
     * <pre>
     *      RSAPublicKey ::= SEQUENCE {
     *                          modulus INTEGER, -- n
     *                          publicExponent INTEGER, -- e
     *                      }
     * </pre>
     * <p>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new ASN1Integer(getModulus()));
    v.add(new ASN1Integer(getPublicExponent()));
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1Integer(org.bouncycastle.asn1.ASN1Integer)

Example 74 with DERSequence

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

the class DSAParameter method toASN1Primitive.

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

Example 75 with DERSequence

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

the class Extension method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(extnId);
    if (critical) {
        v.add(ASN1Boolean.getInstance(true));
    }
    v.add(value);
    return new DERSequence(v);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Aggregations

DERSequence (org.bouncycastle.asn1.DERSequence)119 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)10 Enumeration (java.util.Enumeration)10 X509Certificate (java.security.cert.X509Certificate)9 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)9 DERInteger (org.bouncycastle.asn1.DERInteger)9 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)8 BigInteger (java.math.BigInteger)7 DERIA5String (org.bouncycastle.asn1.DERIA5String)7 DERSet (org.bouncycastle.asn1.DERSet)7 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 ASN1ObjectIdentifier (com.android.org.bouncycastle.asn1.ASN1ObjectIdentifier)5 DERBitString (com.android.org.bouncycastle.asn1.DERBitString)5