Repository navigation
Validation fails for polish ePUAP trusted signature #318
Replies: 4 comments 12 replies
|
Matthias, please note, that it's the same (or similar) issue that I was mailing you privately some time ago. There's possibly also some specific way to determine in who's name signature was created, as Adobe Acrobat states, that document has been correctly signed by Tomasz Drzewiecki: |
|
First, I reduced the validation failure down to the RSA signature validation itself failing. The weird thing is that not all PDF tools agree:
I've stepped through both the iText validation procedure and pyHanko's with a debugger, and I've verified that all the input parameters fed into the backend RSA library are identical. So the discrepancy lies somewhere deeper. Debugging Decoding the DER, we get this: https://lapo.it/asn1js/#MC8wCwYJYIZIAWUDBAIBBCDPVaVMdEkKFY4cOmvqEEtzn4jKJD919syg65pQY8wG1w. But this violates PKCS#1 in a subtle way: the TL;DR the signature encoding is invalid for a pedantic technical reason, which could be the reason why OpenSSL refuses to accept it |
|
On a side note, getting this fixed by gov body might prove next to impossible, as the "official" validator doesn't care and says everything's fine: |
|
We are seeing quite a lot of those signatures, and while I can whitelist SHA256 hash of gov body's certificate, this doesn't seem like a good solution -- or maybe it is? Assuming they won't care about fixing this, which is IMO extremely probable, what other options, besides patching openssl, are on the table? |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to validate the signature in the following document:
Skierowanie_na_wstepne_badania_lekarskie_Testowy_Janusz_signed_EPUAP.pdf
To my knowledge, the signature is valid (based on Adobe Acrobat validation, see image below).

However pyHanko says that "The signature is cryptographically unsound.".
Here's my code:
And here's the result from pretty_print_details() method:
Note: for my use case the certificate does not have to be trusted, at least at this stage of the project. The signature must only be valid, intact and docmdp_ok.
So bottom line is: What am I doing wrong?
All reactions