use of org.bouncycastle.asn1.DERTaggedObject in project signer by demoiselle.
the class PolicyInfo method parse.
@Override
public void parse(ASN1Primitive derObject) {
ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
ASN1Primitive firstObject = derSequence.getObjectAt(0).toASN1Primitive();
this.policyName = new DirectoryString(firstObject.toString());
ASN1Primitive secondObject = derSequence.getObjectAt(1).toASN1Primitive();
String fieldOfApplication = secondObject.toString();
this.fieldOfApplication = new DirectoryString(fieldOfApplication);
this.signingPeriod = new SigningPeriod();
this.signingPeriod.parse(derSequence.getObjectAt(2).toASN1Primitive());
int indice = 3;
ASN1Primitive revocationObject = derSequence.getObjectAt(indice).toASN1Primitive();
if (!(secondObject instanceof DERTaggedObject)) {
indice = 4;
}
if (indice == 3) {
this.revocationDate = new Time();
this.revocationDate.parse(revocationObject);
}
}
use of org.bouncycastle.asn1.DERTaggedObject in project signer by demoiselle.
the class TimestampTrustCondition 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 ttsCertificateTrustTrees:
this.ttsCertificateTrustTrees = new CertificateTrustTrees();
this.ttsCertificateTrustTrees.parse(object);
break;
case ttsRevReq:
this.ttsRevReq = new CertRevReq();
this.ttsRevReq.parse(object);
break;
case ttsNameConstraints:
this.ttsNameConstraints = new NameConstraints();
this.ttsNameConstraints.parse(object);
break;
case cautionPeriod:
this.cautionPeriod = new DeltaTime();
this.cautionPeriod.parse(object);
break;
case signatureTimestampDelay:
this.signatureTimestampDelay = new DeltaTime();
this.signatureTimestampDelay.parse(object);
break;
default:
break;
}
}
}
}
}
use of org.bouncycastle.asn1.DERTaggedObject in project signer by demoiselle.
the class AlgorithmConstraintSet 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 signerAlgorithmConstraints:
this.signerAlgorithmConstraints = new AlgorithmConstraints();
this.signerAlgorithmConstraints.parse(object);
break;
case eeCertAlgorithmConstraints:
this.eeCertAlgorithmConstraints = new AlgorithmConstraints();
this.eeCertAlgorithmConstraints.parse(object);
break;
case caCertAlgorithmConstraints:
this.caCertAlgorithmConstraints = new AlgorithmConstraints();
this.caCertAlgorithmConstraints.parse(object);
break;
case aaCertAlgorithmConstraints:
this.aaCertAlgorithmConstraints = new AlgorithmConstraints();
this.aaCertAlgorithmConstraints.parse(object);
break;
case tsaCertAlgorithmConstraints:
this.tsaCertAlgorithmConstraints = new AlgorithmConstraints();
this.tsaCertAlgorithmConstraints.parse(object);
break;
default:
break;
}
}
}
}
}
use of org.bouncycastle.asn1.DERTaggedObject in project signer by demoiselle.
the class AttributeTrustCondition 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 attrCertificateTrustTrees:
this.attrCertificateTrustTrees = new CertificateTrustTrees();
this.attrCertificateTrustTrees.parse(object);
break;
case attrRevReq:
this.attrRevReq = new CertRevReq();
this.attrRevReq.parse(object);
break;
case attributeConstraints:
this.attributeConstraints = new AttributeConstraints();
this.attributeConstraints.parse(object);
break;
default:
break;
}
}
}
}
super.parse(derObject);
}
use of org.bouncycastle.asn1.DERTaggedObject in project candlepin by candlepin.
the class X509CRLStreamWriter method offsetNextUpdate.
/**
* Write a new nextUpdate time that is the same amount of time ahead of the new thisUpdate
* time as the old nextUpdate was from the old thisUpdate.
*
* @param out
* @param tagNo
* @param oldThisUpdate
* @throws IOException
*/
protected void offsetNextUpdate(OutputStream out, int tagNo, Date oldThisUpdate) throws IOException {
int originalLength = readLength(crlIn, null);
byte[] oldBytes = new byte[originalLength];
readFullyAndTrack(crlIn, oldBytes, null);
ASN1Object oldTime = null;
if (tagNo == UTC_TIME) {
ASN1TaggedObject t = new DERTaggedObject(UTC_TIME, new DEROctetString(oldBytes));
oldTime = ASN1UTCTime.getInstance(t, false);
} else {
ASN1TaggedObject t = new DERTaggedObject(GENERALIZED_TIME, new DEROctetString(oldBytes));
oldTime = ASN1GeneralizedTime.getInstance(t, false);
}
/* Determine the time between the old thisUpdate and old nextUpdate and add it
/* to the new nextUpdate. */
Date oldNextUpdate = Time.getInstance(oldTime).getDate();
long delta = oldNextUpdate.getTime() - oldThisUpdate.getTime();
Date newNextUpdate = new Date(new Date().getTime() + delta);
ASN1Object newTime = null;
if (tagNo == UTC_TIME) {
newTime = new DERUTCTime(newNextUpdate);
} else {
newTime = new DERGeneralizedTime(newNextUpdate);
}
writeNewTime(out, newTime, originalLength);
}
Aggregations