I am trying the free version of the viewer (using Javascript) to test if my document signature is valid.
The PDFTron viewer says the document integrity is valid (the document has not been changed since it was signed), but it also says"Trust could not be established".
I did try to add my PEM file of my certificate like this :
var bytes = []; // char codes
for (var i = 0; i < me.options.certificate.length; ++i) {
var code = me.options.certificate.charCodeAt(i);
bytes = bytes.concat([code & 0xff, code / 256 >>> 0]);
}
VerificationOptions.addTrustedCertificates([bytes]);
where “me.options.certificate” is my PEM file as string.
But the viewer still doesn’t validate the certificate.
This overload takes no account of trust-level flags because none are available in the P7C format. Therefore, when this function is used, all certificates in the P7C file will be loaded as if trusted for everything, which may lead to false positives when compared to other PDF software. (Most applications use the FDF Cert Exchange format.) The FDF-trust-list-loading function “LoadTrustList” should be used instead whenever possible.
However, this is probably not the main issue you are having.
Please send us your signed PDF and public-key root certificate.
Hello, this is the self signed certificate, the public key PEM file I used as string in “me.options.certificate” and the PDF file I signed. sample1 (29).pdf (59.6 KB)
Maybe the input for “addTrustedCertificates” is the wrong one ? I should maybe use the PEM certificate file instead of public key file?
Thank you for helping
public key PEM :
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArG1XmB+UZo9yZiCDPLCq
K+eaXb96rHAG4fvXXxitYdVrCJtYxzXN9ALj10giZIp3DkJcsAzgdv40gjWljrM3
SJz+BvxlQs7eixo5J+cl1IOpYdQHSi9uv95U96gBDZKA1LJvkeV4OEyx2f497myj
UJsD7pGmYQ8MkGFic67zm1jhiM9IfcB9DrWr5uj8F1Rhii1R1fnAJ8ScgmV5zGXC
/ikv8yWKC4Phjpz+qKwkU+dDi2Cr3AAIPskj+xA3cJpMsf+6D06q9pPKLpi7ADXg
dFrQk0bDllqtuF1Xh2OAKm2/HAM5flPKljHUcRbbPaMqUmn08oHYpLxb/XvvbWGf
iQIDAQAB
-----END PUBLIC KEY-----