This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.35k
stars
1.99k
forks
source link
[BUG] jarsigner + jca does not report 403 returned during sign with RSA-HSM key #42859
If service provider is missing permission for signing (Key Vault Crypto User role) but have permission to read certificate (Key Vault Certificate User role) signing finishes successfully but signature is not valid.
To Reproduce
certificate with advanced policy config in Key vault:
Extended Key Usages: 1.3.6.1.5.5.7.3.1, 1.3.6.1.5.5.7.3.2, 1.3.6.1.5.5.7.3.3
X.509 Key Usage flags: Digital Signature, Key Encipherment
Reuse key on renewal: NO
Exportable Private Key: NO
Key Type: RSA-HSM
Key Size: 3072
Enable Cert Transparency: NO
...
jar: beginEntry META-INF/<REDACTED>.RSA
jar: processEntry: processing block
jar: processEntry caught: java.security.SignatureException: Bad signature length: got 0 but was expecting 384
jar: done with meta!
...
WARNING: Signature is either not parsable or not verifiable, and the jar will be treated as unsigned. For more information, re-run jarsigner with debug enabled (-J-Djava.security.debug=jar).
Expected behavior
ideally signing fails with hint about missing permission or at least logs error about receiving 403
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
Describe the bug
To Reproduce
Expected behavior
Setup
Additional context
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report