Search in sources :

Example 81 with ASN1Sequence

use of org.openecard.bouncycastle.asn1.ASN1Sequence in project signer by demoiselle.

the class SignerRules method parse.

@Override
public void parse(ASN1Primitive primitive) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(primitive);
    int total = derSequence.size();
    if (total > 0) {
        for (int i = 0; i < total; i++) {
            ASN1Primitive object = derSequence.getObjectAt(i).toASN1Primitive();
            if (object instanceof DERTaggedObject) {
                DERTaggedObject derTaggedObject = (DERTaggedObject) object;
                TAG tag = TAG.getTag(derTaggedObject.getTagNo());
                switch(tag) {
                    case mandatedCertificateRef:
                        this.mandatedCertificateRef = CertRefReq.parse(object);
                        break;
                    case mandatedCertificateInfo:
                        this.mandatedCertificateInfo = CertInfoReq.parse(object);
                        break;
                    case signPolExtensions:
                        this.signPolExtensions = new SignPolExtensions();
                        this.signPolExtensions.parse(object);
                        break;
                    default:
                        break;
                }
            }
        }
    }
    int i = 0;
    ASN1Encodable object = derSequence.getObjectAt(i);
    if (!(object instanceof DERSequence)) {
        if (object instanceof ASN1Boolean) {
            this.externalSignedData = ((ASN1Boolean) object).isTrue();
        }
        i++;
    }
    this.mandatedSignedAttr = new CMSAttrs();
    this.mandatedSignedAttr.parse(derSequence.getObjectAt(i).toASN1Primitive());
    i++;
    this.mandatedUnsignedAttr = new CMSAttrs();
    this.mandatedUnsignedAttr.parse(derSequence.getObjectAt(i).toASN1Primitive());
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERSequence(org.bouncycastle.asn1.DERSequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) ASN1Boolean(org.bouncycastle.asn1.ASN1Boolean) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 82 with ASN1Sequence

use of org.openecard.bouncycastle.asn1.ASN1Sequence in project signer by demoiselle.

the class SigningPeriod method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    this.notBefore = new GeneralizedTime();
    this.notBefore.parse(derSequence.getObjectAt(0).toASN1Primitive());
    if (derSequence.size() == 2) {
        this.notAfter = new GeneralizedTime();
        this.notAfter.parse(derSequence.getObjectAt(1).toASN1Primitive());
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) GeneralizedTime(org.demoiselle.signer.policy.engine.asn1.GeneralizedTime)

Example 83 with ASN1Sequence

use of org.openecard.bouncycastle.asn1.ASN1Sequence in project signer by demoiselle.

the class LPA method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence sequence = ASN1Object.getDERSequence(derObject);
    ASN1Primitive policyInfos = sequence.getObjectAt(0).toASN1Primitive();
    DLSequence policyInfosSequence = (DLSequence) policyInfos;
    if (policyInfosSequence != null && policyInfosSequence.size() > 0) {
        this.policyInfos = new ArrayList<>();
        for (int i = 0; i < policyInfosSequence.size(); i++) {
            PolicyInfo policyInfo = new PolicyInfo();
            policyInfo.parse(policyInfosSequence.getObjectAt(i).toASN1Primitive());
            this.policyInfos.add(policyInfo);
        }
    }
    this.nextUpdate = new Time();
    this.nextUpdate.parse(sequence.getObjectAt(1).toASN1Primitive());
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DLSequence(org.bouncycastle.asn1.DLSequence) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 84 with ASN1Sequence

use of org.openecard.bouncycastle.asn1.ASN1Sequence in project signer by demoiselle.

the class SigningCertTrustCondition method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    this.signerTrustTrees = new CertificateTrustTrees();
    this.signerTrustTrees.parse(derSequence.getObjectAt(0).toASN1Primitive());
    this.signerRevReq = new CertRevReq();
    this.signerRevReq.parse(derSequence.getObjectAt(1).toASN1Primitive());
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence)

Example 85 with ASN1Sequence

use of org.openecard.bouncycastle.asn1.ASN1Sequence in project signer by demoiselle.

the class PolicyConstraints method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    int total = derSequence.size();
    if (total > 0) {
        for (int i = 0; i < total; i++) {
            ASN1Primitive object = derSequence.getObjectAt(i).toASN1Primitive();
            if (object instanceof DERTaggedObject) {
                DERTaggedObject derTaggedObject = (DERTaggedObject) object;
                TAG tag = TAG.getTag(derTaggedObject.getTagNo());
                switch(tag) {
                    case requireExplicitPolicy:
                        this.requireExplicitPolicy = new SkipCerts();
                        this.requireExplicitPolicy.parse(object);
                        break;
                    case inhibitPolicyMapping:
                        this.inhibitPolicyMapping = new SkipCerts();
                        this.inhibitPolicyMapping.parse(object);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Aggregations

ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)198 IOException (java.io.IOException)68 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)56 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)49 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)39 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)37 ArrayList (java.util.ArrayList)36 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)34 DEROctetString (org.bouncycastle.asn1.DEROctetString)34 CRLDistPoint (org.bouncycastle.asn1.x509.CRLDistPoint)32 X509Certificate (java.security.cert.X509Certificate)31 ASN1Primitive (org.bouncycastle.asn1.ASN1Primitive)30 DERSequence (org.bouncycastle.asn1.DERSequence)30 Enumeration (java.util.Enumeration)29 DistributionPoint (org.bouncycastle.asn1.x509.DistributionPoint)29 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)28 DERIA5String (org.bouncycastle.asn1.DERIA5String)28 List (java.util.List)27 BigInteger (java.math.BigInteger)26 DERUTF8String (org.bouncycastle.asn1.DERUTF8String)26