-
Hello @gettalong, Recently, i trying to sign a PDF with private key from Hardware Security Management (PKCS#11) and HexaPDF via SignedDataCreator, but i dont understand the quotes " # If the #key attribute is not set, the digest algorithm and the already digested data to be # signed is yielded and the block needs to return the signature. ". Could you please make an example for this. I've tried to make one. It's successful to sign and return the PDF file, but I can't verify the signature. It's also successful to sign PKCS#11 and return the signature I expect, but I can't embed it into the PDF. signature form PKCS#11 sign function in my case has size equal to 128.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It does exactly what it says: If the certificate key is not provider, HexaPDF can't sign the digest. Therefore it yields the digest algorithm that is used by the signed data creator and the hash that should be signed. The responsible of the caller is that it returns the signed hash. A simple implementation where
From what I see from your code you are already doing this with Could you provide an original PDF and the signed version for inspection? |
Beta Was this translation helpful? Give feedback.
It does exactly what it says: If the certificate key is not provider, HexaPDF can't sign the digest. Therefore it yields the digest algorithm that is used by the signed data creator and the hash that should be signed. The responsible of the caller is that it returns the signed hash. A simple implementation where
key
is an OpenSSL private key would be this:From what I see from your code you are already doing this with
PKCS11RSAPrivateKey
. One thing I don't understand in your code is the creation of thepdf_temp
part. This is not necessary as it would mean that you are signing the PDF twice.C…