I'm using iText 2.1.7 and BC 1.49 Even though I can signing and timestamping a file, when I open it with adobe reader I get a "timestamp authority not available" status (signature it's ok and reader tell me that the file is timestamped). Here is my code after when timestamping:
...
byte[] tstoken = timeStampClient.getTimeStampToken(tsdata);
Attribute signatureTimeStamp = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, new DERSet(ASN1Primitive.fromByteArray(tstoken)));
SignerInformationStore signerStore = cmsSignedData.getSignerInfos();
ArrayList<SignerInformation> siArray = new ArrayList<SignerInformation>();
Iterator<SignerInformation> infos = signerStore.getSigners().iterator();
while (infos.hasNext()) {
SignerInformation si = infos.next();
Hashtable<ASN1ObjectIdentifier, Attribute> unsignedAttrHash = si.getUnsignedAttributes().toHashtable();
unsignedAttrHash.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, signatureTimeStamp);
siArray.add(SignerInformation.replaceUnsignedAttributes(si, new AttributeTable(unsignedAttrHash)));
}
SignerInformationStore newSignerStore = new SignerInformationStore(siArray);
return CMSSignedData.replaceSigners(cmsSignedData, newSignerStore);
...
The returned CmsSignedData (.getEncoded()) is what I embbed into pdf. I already test the TSA server and signer certificate using Acrobat and those are ok.
Thank you in advance.
-- Added -- Examples:
Acro signed pdf (same cert, same tsa server)