Search in sources :

Example 6 with BERSequence

use of org.bouncycastle.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 7 with BERSequence

use of org.bouncycastle.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 8 with BERSequence

use of org.bouncycastle.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 9 with BERSequence

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

Example 10 with BERSequence

use of org.bouncycastle.asn1.BERSequence in project XobotOS by xamarin.

the class SignedData method toASN1Object.

/**
     * Produce an object suitable for an ASN1OutputStream.
     * <pre>
     *  SignedData ::= SEQUENCE {
     *      version Version,
     *      digestAlgorithms DigestAlgorithmIdentifiers,
     *      contentInfo ContentInfo,
     *      certificates
     *          [0] IMPLICIT ExtendedCertificatesAndCertificates
     *                   OPTIONAL,
     *      crls
     *          [1] IMPLICIT CertificateRevocationLists OPTIONAL,
     *      signerInfos SignerInfos }
     * </pre>
     */
public DERObject toASN1Object() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(version);
    v.add(digestAlgorithms);
    v.add(contentInfo);
    if (certificates != null) {
        v.add(new DERTaggedObject(false, 0, certificates));
    }
    if (crls != null) {
        v.add(new DERTaggedObject(false, 1, crls));
    }
    v.add(signerInfos);
    return new BERSequence(v);
}
Also used : DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) BERSequence(org.bouncycastle.asn1.BERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Aggregations

BERSequence (org.bouncycastle.asn1.BERSequence)14 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)12 BERTaggedObject (org.bouncycastle.asn1.BERTaggedObject)7 DERTaggedObject (org.bouncycastle.asn1.DERTaggedObject)4 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)3 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)3 ASN1Set (org.bouncycastle.asn1.ASN1Set)3 DERInteger (org.bouncycastle.asn1.DERInteger)3 Enumeration (java.util.Enumeration)2 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)2 BERApplicationSpecific (org.bouncycastle.asn1.BERApplicationSpecific)2 BERConstructedOctetString (org.bouncycastle.asn1.BERConstructedOctetString)2 BERSet (org.bouncycastle.asn1.BERSet)2 DERApplicationSpecific (org.bouncycastle.asn1.DERApplicationSpecific)2 DERBMPString (org.bouncycastle.asn1.DERBMPString)2 DERBitString (org.bouncycastle.asn1.DERBitString)2 DERBoolean (org.bouncycastle.asn1.DERBoolean)2 DEREnumerated (org.bouncycastle.asn1.DEREnumerated)2 DERExternal (org.bouncycastle.asn1.DERExternal)2 DERGeneralizedTime (org.bouncycastle.asn1.DERGeneralizedTime)2