Search in sources :

Example 86 with ASN1Sequence

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

the class CertificateTrustPoint method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    DERSequence x509Sequence = (DERSequence) derSequence.getObjectAt(0).toASN1Primitive();
    try {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(x509Sequence.getEncoded());
        this.trustpoint = (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(byteArrayInputStream);
    } catch (Throwable error) {
        error.printStackTrace();
    }
    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 pathLenConstraint:
                        this.pathLenConstraint = new PathLenConstraint();
                        this.pathLenConstraint.parse(object);
                        break;
                    case acceptablePolicySet:
                        this.acceptablePolicySet = new AcceptablePolicySet();
                        this.acceptablePolicySet.parse(object);
                        break;
                    case nameConstraints:
                        this.nameConstraints = new NameConstraints();
                        this.nameConstraints.parse(object);
                        break;
                    case policyConstraints:
                        this.policyConstraints = new PolicyConstraints();
                        this.policyConstraints.parse(object);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERSequence(org.bouncycastle.asn1.DERSequence) ByteArrayInputStream(java.io.ByteArrayInputStream) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 87 with ASN1Sequence

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

the class CommitmentType method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    this.identifier = new CommitmentTypeIdentifier();
    this.identifier.parse(derSequence.getObjectAt(0).toASN1Primitive());
    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 fieldOfApplication:
                        this.fieldOfApplication = new FieldOfApplication();
                        this.fieldOfApplication.parse(object);
                        break;
                    case semantics:
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 88 with ASN1Sequence

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

the class CommonRules 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 signerAndVeriferRules:
                        this.signerAndVeriferRules = new SignerAndVerifierRules();
                        this.signerAndVeriferRules.parse(object);
                        break;
                    case signingCertTrustCondition:
                        this.signingCertTrustCondition = new SigningCertTrustCondition();
                        this.signingCertTrustCondition.parse(object);
                        break;
                    case timeStampTrustCondition:
                        this.timeStampTrustCondition = new TimestampTrustCondition();
                        this.timeStampTrustCondition.parse(object);
                        break;
                    case attributeTrustCondition:
                        this.attributeTrustCondition = new AttributeTrustCondition();
                        this.attributeTrustCondition.parse(object);
                        break;
                    case algorithmConstraintSet:
                        this.algorithmConstraintSet = new AlgorithmConstraintSet();
                        this.algorithmConstraintSet.parse(object);
                        break;
                    case signPolExtensions:
                        this.signPolExtensions = new SignPolExtensions();
                        this.signPolExtensions.parse(object);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 89 with ASN1Sequence

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

the class SelectedCommitmentTypes method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    ASN1Primitive object = derSequence.getObjectAt(0).toASN1Primitive();
    if (object instanceof DERNull) {
        this.recognizedCommitmentType = null;
    } else if (object instanceof DERSequence) {
        this.recognizedCommitmentType = new CommitmentType();
        this.recognizedCommitmentType.parse(object);
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) DERSequence(org.bouncycastle.asn1.DERSequence) DERNull(org.bouncycastle.asn1.DERNull) ASN1Primitive(org.bouncycastle.asn1.ASN1Primitive)

Example 90 with ASN1Sequence

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

the class SignerAndVerifierRules method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    this.signerRules = new SignerRules();
    this.signerRules.parse(derSequence.getObjectAt(0).toASN1Primitive());
    this.verifierRules = new VerifierRules();
    this.verifierRules.parse(derSequence.getObjectAt(1).toASN1Primitive());
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence)

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