Search in sources :

Example 21 with BERSequence

use of com.github.zhenwei.core.asn1.BERSequence in project XobotOS by xamarin.

the class ContentInfo method toASN1Object.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * <pre>
     * ContentInfo ::= SEQUENCE {
     *          contentType ContentType,
     *          content
     *          [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
     * </pre>
     */
public DERObject toASN1Object() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(contentType);
    if (content != null) {
        v.add(new BERTaggedObject(0, content));
    }
    return new BERSequence(v);
}
Also used : BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) BERTaggedObject(org.bouncycastle.asn1.BERTaggedObject)

Example 22 with BERSequence

use of com.github.zhenwei.core.asn1.BERSequence in project XobotOS by xamarin.

the class EncryptedData method toASN1Object.

public DERObject toASN1Object() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new DERInteger(0));
    v.add(data);
    return new BERSequence(v);
}
Also used : BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) DERInteger(org.bouncycastle.asn1.DERInteger)

Example 23 with BERSequence

use of com.github.zhenwei.core.asn1.BERSequence in project robovm by robovm.

the class ContentInfo method toASN1Primitive.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * <pre>
     * ContentInfo ::= SEQUENCE {
     *          contentType ContentType,
     *          content
     *          [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(contentType);
    if (content != null) {
        v.add(new BERTaggedObject(true, 0, content));
    }
    if (isBer) {
        return new BERSequence(v);
    } else {
        return new DLSequence(v);
    }
}
Also used : DLSequence(org.bouncycastle.asn1.DLSequence) BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) BERTaggedObject(org.bouncycastle.asn1.BERTaggedObject)

Example 24 with BERSequence

use of com.github.zhenwei.core.asn1.BERSequence in project robovm by robovm.

the class EncryptedData method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new ASN1Integer(0));
    v.add(data);
    return new BERSequence(v);
}
Also used : BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1Integer(org.bouncycastle.asn1.ASN1Integer)

Example 25 with BERSequence

use of com.github.zhenwei.core.asn1.BERSequence in project robovm by robovm.

the class Pfx method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new ASN1Integer(3));
    v.add(contentInfo);
    if (macData != null) {
        v.add(macData);
    }
    return new BERSequence(v);
}
Also used : BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1Integer(org.bouncycastle.asn1.ASN1Integer)

Aggregations

BERSequence (org.bouncycastle.asn1.BERSequence)21 BERSequence (com.github.zhenwei.core.asn1.BERSequence)18 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)18 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)17 BERTaggedObject (org.bouncycastle.asn1.BERTaggedObject)11 DERTaggedObject (org.bouncycastle.asn1.DERTaggedObject)7 BERTaggedObject (com.github.zhenwei.core.asn1.BERTaggedObject)6 DERTaggedObject (com.github.zhenwei.core.asn1.DERTaggedObject)6 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)6 ASN1Set (org.bouncycastle.asn1.ASN1Set)6 HashSet (java.util.HashSet)5 Iterator (java.util.Iterator)5 ASN1Set (com.github.zhenwei.core.asn1.ASN1Set)4 Enumeration (java.util.Enumeration)4 ASN1Integer (com.github.zhenwei.core.asn1.ASN1Integer)3 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)3 AlgorithmIdentifier (com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)3 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)3 BERApplicationSpecific (org.bouncycastle.asn1.BERApplicationSpecific)3 BERConstructedOctetString (org.bouncycastle.asn1.BERConstructedOctetString)3