GoogleCloudPlatform / GoogleCloudPlatform/kms-integrations
[kmsp11] Incomplete Certificate Chain for Signatures generated via Jarsigner (SunPKCS11)
- Dominant language
- C++
- Stars
- 47
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
When using kmsp11 for Java signing via SunPKCS11, the certificate chain is resolved by [querying the PKCS#11 library implementation](https://github.com/openjdk/jdk/blob/bcb5e69505f6cc8a4f323924cd2c58e630595fc0/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java#L1220-L1253) for each certificate up to and including the self-signed root certificate.
While it is possible to specify [multiple certificates](https://github.com/GoogleCloudPlatform/kms-integrations/blob/1f2649ed4536919be91730dccef84803f7ace6c3/kmsp11/config/config.proto#L91-L93) in the kmsp11 library configuration, the kmsp11 library implementation appears to refuse to serve certificates via the PKCS#11 interface for certificates that do not have a matching Cloud KMS Crypto Key in the [key_ring](https://github.com/GoogleCloudPlatform/kms-integrations/blob/1f2649ed4536919be91730dccef84803f7ace6c3/kmsp11/config/config.proto#L83-L85) identified in the config.
As a result, signatures generated by jarsigner with kmsp11 (via SunPKCS11) are created with an incomplete set of certificates included in the signature metadata and it is not possible to verify the generated signature without manually importing the intermediate and root certificate into the Java Keystore at the time of verification.
Contributor guide
Assessment
This issue has not been assessed yet.