-
Notifications
You must be signed in to change notification settings - Fork 29
Allow locating certificates using issuer + subject CN in CAPI KMS. #696
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
Conversation
Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
return uintptr(kh), nil | ||
} | ||
|
||
func cryptFindCertificateKeyContainerName(certContext *windows.CertContext) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maraino This function is not currently used, and I think it will ultimately need to change a bit, but I'm leaving it in. Right now, it will populate the certificate context when the DLL calls succeed, and the error handling is now correct based on feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
if rsaOpts.SaltLength == rsa.PSSSaltLengthEqualsHash { | ||
rsaOpts.SaltLength = rsaOpts.Hash.Size() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not cryptical, I can do this later, but when SaltLength is rsa.PSSSaltLengthAuto
the salt length is:
(modulus_key_size - 1 + 7)/8 - hash_length - 2
For example, for a 4096-bit modules key and SHA256 it should be:
(4096 - 1 + 7)/8 - 32 - 2 = 478
This PR provides support a
cn
argument in CAPIKMS URIs. It must be provided in conjunction with the issuer name. Since these parameters may not be enough to uniquely identity certificates, the first certificate matching the criteria is returned.💔Thank you!