GoogleCloudPlatform / GoogleCloudPlatform/kms-integrations

Unable to use signtool /ds option with the CNG provider

Open
#20 8 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
47
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Hello,

Because of the absence of an x86 version of the provider (See #18), I'm trying a workaround by using the following steps:

1. get the file digest by using the `/dg` option

signtool sign /q /f "%CertificatePublicKeyFilename%" /du %SignatureUrl% /fd sha256 /dg . "%FileToSign%"

2. Sign the generated digest with the CNG provider and the `/ds` option

signtool sign /q /f "%CertificatePublicKeyFilename%" /csp "%GoogleCSPName%" /kc "%GoogleCloudKeyVersionFullPath%" /ds "%DigestFile%"

3. Integrate the signed digest with the `/di` option

signtool sign /q /f "%CertificatePublicKeyFilename%" /di . "%FileToSign%"

4. Timestamp the generated signature

signtool timestamp /q /tr %SignatureTimeStampURL% /td sha256 "%FileToSign%"

When using a certificate whose private key is stored on a physical usb token (Yubikey), this works fine.
But when I use the CNG provider, I get the following error:

I0927 12:56:16.817818 31368 logging.cc:81] returning 0x80090027 from SignHashFn due to status INVALID_ARGUMENT: at bridge.cc:421: unsupported pPaddingInfo [type.googleapis.com/kmscng.StatusDetails='SECURITY_STATUS=0x80090027']

Looking at [bridge.cc:421](https://github.com/GoogleCloudPlatform/kms-integrations/blob/master/kmscng/main/bridge.cc#L421) the error seems to be created on purpose but I'm not sure what to make of this.
I would simply remove the test as it seems `pPaddingInfo` is not used at all in that function, but this must be a very naive approach.

Any help would be most welcome.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.