// unsignedAttributeTable, PKCSObjectIdentifiers.pkcs_9_at_messageDigest);
DERSequence timeStampDerSequence = this.getAttribute(signedAttributeTable, unsignedAttributeTable, PKCSObjectIdentifiers.id_aa_signatureTimeStampToken);
if (timeStampDerSequence != null) {
if (timeStampDerSequence.size() == 2) {
ASN1Primitive derObjectIdentifier = ((ASN1Primitive) timeStampDerSequence.getObjectAt(0)).toASN1Primitive();
ASN1Primitive derObjectValue = ((ASN1Primitive) timeStampDerSequence.getObjectAt(1)).toASN1Primitive();
if ((derObjectIdentifier instanceof ASN1ObjectIdentifier) && (derObjectValue instanceof DERSet)) {
// ASN1ObjectIdentifier asn1ObjectIdentifier = (ASN1ObjectIdentifier)
// derObjectIdentifier;
DERSet set = (DERSet) derObjectValue;
ASN1Encodable encodable = set.getObjectAt(0);
TimeStampToken timeStampToken = new TimeStampToken(new CMSSignedData(encodable.toASN1Primitive().getEncoded()));
TimeStamp timeStamp = BouncyCastleTimeStampHelper.toTimeStamp(timeStampToken);
signature.setTimeStamp(timeStamp);
}
}
}
DERSequence signTimeDerSequence = this.getAttribute(signedAttributeTable, unsignedAttributeTable, PKCSObjectIdentifiers.pkcs_9_at_signingTime);
if (signTimeDerSequence != null) {
ASN1Primitive derObjectIdentifier = ((ASN1Primitive) signTimeDerSequence.getObjectAt(0)).toASN1Primitive();
ASN1Primitive derObjectValue = ((ASN1Primitive) signTimeDerSequence.getObjectAt(1)).toASN1Primitive();
if ((derObjectIdentifier instanceof ASN1ObjectIdentifier) && (derObjectValue instanceof DERSet)) {
DERSet set = (DERSet) derObjectValue;
ASN1UTCTime time = (ASN1UTCTime) set.getObjectAt(0);
signature.setDate(time.getAdjustedDate());
}