I’m trying to extract the signing time from my pdf document, I know it has a timestamp from the Acrobat below :
But when I try to print the authenticated attributes, I can’t find them (OID for signingTime is 1.2.840.113549.1.9.5)
This is my code for finding the signingTime Attributes :
// Extract all authenticated attributes
const authenticatedAttributes = attrs.map(attribute => {
const oid = forge.asn1.derToOid(attribute.value[0].value);
const attributeName = forge.pki.oids[oid] || oid; // Try to resolve OID to a human-readable name // Extract the value, which might be a date, a string, or another encoded type
let value;
try {
value = forge.util.bytesToUtf8(attribute.value[1].value[0].value);
} catch (e) {
value = forge.util.bytesToHex(attribute.value[1].value[0].value);
}
return {
oid,
name: attributeName,
value,
};
});
console.log("Authenticated Attributes:", authenticatedAttributes);
But this is the console info for my “Authenticated Attributes” there are no signingTime OIDs, even though I know it exists from the Acrobat Signature Details above.
Can anyone please help?
The steps in order for me to extract the data is as follows:
const verify = (signature, signedData, signatureMeta) => {
const message = getMessageFromSignature(signature);
const {
certificates,
rawCapture: {
signature: sig,
authenticatedAttributes: attrs,
digestAlgorithm,
},
} = message;
// console.log(attrs);
// Extract all authenticated attributes
const authenticatedAttributes = attrs.map(attribute => {
const oid = forge.asn1.derToOid(attribute.value[0].value);
const attributeName = forge.pki.oids[oid] || oid; // Try to resolve OID to a human-readable name
// Extract the value, which might be a date, a string, or another encoded type
let value;
try {
value = forge.util.bytesToUtf8(attribute.value[1].value[0].value);
} catch (e) {
value = forge.util.bytesToHex(attribute.value[1].value[0].value);
}
return {
oid,
name: attributeName,
value,
};
});
console.log("Authenticated Attributes:", authenticatedAttributes);
};
I have read many similar questions :
the signature includes en embedded timeStamp but it could not be verified
How to decode timestamp from digital PKCS7 signature?
Verify RFC 3161 trusted timestamp
And have read the documentation about digital signature from:
https://www.adobe.com/devnet-docs/acrobatetk/tools/DigSigDC/Acrobat_DigitalSignatures_in_PDF.pdf
https://www.ietf.org/rfc/rfc3161.txt
But to no avail.