use of org.demoiselle.signer.policy.engine.asn1.GeneralizedTime in project signer by demoiselle.
the class PolicyInfo method parse.
@Override
public void parse(ASN1Primitive primitive) {
ASN1Sequence sequence1 = ASN1Object.getDERSequence(primitive);
this.signingPeriod = new SigningPeriod();
this.signingPeriod.parse(sequence1.getObjectAt(0).toASN1Primitive());
int indice = 2;
ASN1Primitive secondObject = sequence1.getObjectAt(1).toASN1Primitive();
if (secondObject instanceof ASN1ObjectIdentifier) {
indice = 1;
}
if (indice == 2) {
this.revocationDate = new GeneralizedTime();
this.revocationDate.parse(secondObject);
}
this.policyOID = new ObjectIdentifier();
this.policyOID.parse(sequence1.getObjectAt(indice).toASN1Primitive());
DERIA5String policyURI = (DERIA5String) sequence1.getObjectAt(indice + 1);
this.policyURI = policyURI.getString();
ASN1Primitive policyDigest = sequence1.getObjectAt(indice + 2).toASN1Primitive();
ASN1Sequence sequence2 = ASN1Sequence.getInstance(policyDigest);
DEROctetString derOctetString = (DEROctetString) sequence2.getObjectAt(1).toASN1Primitive();
ASN1Sequence sequence3 = ASN1Object.getDERSequence(sequence2.getObjectAt(0).toASN1Primitive());
ASN1ObjectIdentifier objectIdentifier = (ASN1ObjectIdentifier) sequence3.getObjectAt(0).toASN1Primitive();
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(objectIdentifier);
this.policyDigest = new OtherHashAlgAndValue(algorithmIdentifier, derOctetString);
}
Aggregations