Search in sources :

Example 21 with SignedData

use of com.github.zhenwei.core.asn1.pkcs.SignedData in project LinLong-Java by zhenwei1108.

the class SignedData method toASN1Primitive.

/**
 * 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 ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector(6);
    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(com.github.zhenwei.core.asn1.DERTaggedObject) BERSequence(com.github.zhenwei.core.asn1.BERSequence) ASN1EncodableVector(com.github.zhenwei.core.asn1.ASN1EncodableVector)

Aggregations

ASN1ObjectIdentifier (com.github.zhenwei.core.asn1.ASN1ObjectIdentifier)7 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)6 ASN1Set (com.github.zhenwei.core.asn1.ASN1Set)6 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)5 SignedData (com.github.zhenwei.core.asn1.pkcs.SignedData)5 Iterator (java.util.Iterator)5 AlgorithmIdentifier (com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)4 ContentInfo (com.github.zhenwei.pkix.util.asn1.cms.ContentInfo)4 X509Certificate (java.security.cert.X509Certificate)4 ArrayList (java.util.ArrayList)4 ASN1InputStream (com.github.zhenwei.core.asn1.ASN1InputStream)3 ASN1TaggedObject (com.github.zhenwei.core.asn1.ASN1TaggedObject)3 BERSequence (com.github.zhenwei.core.asn1.BERSequence)3 DERSet (com.github.zhenwei.core.asn1.DERSet)3 IOException (java.io.IOException)3 List (java.util.List)3 ASN1Integer (com.github.zhenwei.core.asn1.ASN1Integer)2 ASN1StreamParser (com.github.zhenwei.core.asn1.ASN1StreamParser)2 BERSequenceGenerator (com.github.zhenwei.core.asn1.BERSequenceGenerator)2 DERTaggedObject (com.github.zhenwei.core.asn1.DERTaggedObject)2