Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsassaPss/SHA512 signature verification error #200

Open
wambla opened this issue Dec 25, 2023 · 0 comments
Open

rsassaPss/SHA512 signature verification error #200

wambla opened this issue Dec 25, 2023 · 0 comments

Comments

@wambla
Copy link

wambla commented Dec 25, 2023

Recent Italian e-passports use rsassaPss/SHA512 for Document Signing Certificate.
The signature verification fails with OpenSSL error:
ERROR: code: 67625095, reason: error:0407E087:rsa routines:RSA_verify_PKCS1_PSS_mgf1:salt length recovery failed

The static method verifySignature() in OpenSSLUtils class set the digest to SHA256 based on the string "rsassapss" instead of using the correct hashing algorithm.

} else if digestType.contains( "sha256" ) || digestType.contains( "rsassapss" )  {
            digest = "sha256"

Sorry to report this issue, I'm sure there is/was a reason for the code above but I don't know much about digital certificate standards and formats. Currently it fails the verification for rsassaPss/SHA512 signatures. I temporarily fixed the issue in my local code by passing the hashing algorithm string from the signed attributes as an extra parameters to use only in case of a "rsassapss" to the mentioned method.

} else if digestType.contains( "sha256" ) {
            digest = "sha256"
...
} else if digestType.contains( "rsassapss" ) {
            digest = hashAlgo.lowercased()
} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant