-
Notifications
You must be signed in to change notification settings - Fork 547
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
expand LoadPrivateKey in pkg/cosign to support Sigstore Encrypted EC keys ("EC PRIVATE KEY" format) #3775
Labels
enhancement
New feature or request
Comments
dmitris
changed the title
expand LoadPrivateKey in pkg/cosign to support Sigstore Encrypted EC keys
expand LoadPrivateKey in pkg/cosign to support Sigstore Encrypted EC keys ("EC PRIVATE KEY" format)
Jul 10, 2024
dmitris
added a commit
to dmitris/cosign
that referenced
this issue
Jul 10, 2024
Currently ImportKeyPair() in pkg/cosign supports only private keys in PKCS sigstore#8 form. This change extends it to also support PKCS #1 for RSA keys ("RSA PUBLIC KEY") and SEC 1 for EC keys ("EC PRIVATE KEY"). Fix sigstore#3775. Signed-off-by: Dmitry S <[email protected]>
dmitris
added a commit
to dmitris/cosign
that referenced
this issue
Jul 10, 2024
Currently ImportKeyPair() in pkg/cosign supports only private keys in PKCS sigstore#8 form. This change extends it to also support PKCS #1 for RSA keys ("RSA PUBLIC KEY") and SEC 1 for EC keys ("EC PRIVATE KEY"). Fix sigstore#3775. Signed-off-by: Dmitry S <[email protected]>
dmitris
added a commit
to dmitris/cosign
that referenced
this issue
Jul 10, 2024
Currently ImportKeyPair() in pkg/cosign supports only private keys in PKCS sigstore#8 form. This change extends it to also support PKCS #1 for RSA keys ("RSA PUBLIC KEY") and SEC 1 for EC keys ("EC PRIVATE KEY"). Fix sigstore#3775. Signed-off-by: Dmitry S <[email protected]>
closing per comments |
dmitris
added a commit
to dmitris/cosign
that referenced
this issue
Jul 11, 2024
Currently ImportKeyPair() in pkg/cosign supports only private keys in PKCS sigstore#8 form. This change extends it to also support PKCS #1 for RSA keys ("RSA PUBLIC KEY") and SEC 1 for EC keys ("EC PRIVATE KEY"). Fix sigstore#3775. Signed-off-by: Dmitry S <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Currently LoadPrivateKey fails if given a Sigstore Encrypted private key. Adding a key as
pemcosigneckey
below and trying to use it in the unit testTestReadingPrivatePemTypes
produces an error:parsing private key: x509: failed to parse private key (use ParseECPrivateKey instead for this key format)
. Currently, the LoadPrivateKey function assumes the PKCS8 encoding and calls only x509.ParsePKCS8PrivateKey -cosign/pkg/cosign/keys.go
Line 223 in ca682f2
If this is a "conscious" requirement, we should document it (and add unit tests with expected failure) - otherwise
let's expand
LoadPrivateKey
to try different x509 parsing functions to load private keys, at least ParsePKCS8PrivateKey and ParseECPrivateKey, maybe also [ParsePKCS1PrivateKey.test case
Test error:
The text was updated successfully, but these errors were encountered: