Skip to content
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

Add support for parsing PKCS#1 priv/pub keys, SEC1 priv keys #638

Merged
merged 1 commit into from Aug 23, 2022

Conversation

haydentherapper
Copy link
Contributor

This adds support for parsing RSA public and private keys, and SEC 1 EC
private keys. This should reduce unexpected format errors for library
users.

Signed-off-by: Hayden Blauzvern hblauzvern@google.com

Summary

Release Note

Added support for parsing PKCS#1 private and public keys, and SEC 1 private keys

Documentation

This adds support for parsing RSA public and private keys, and SEC 1 EC
private keys. This should reduce unexpected format errors for library
users.

Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
@dekkagaijin
Copy link
Member

"PRIVATE KEY" can begin blocks for arbitrary key types, yes? Is there an RFC which disambiguates them?

@haydentherapper
Copy link
Contributor Author

PKCS#8 encoding is typically associated with "PRIVATE KEY", which the code should already be doing for marshalling.

@haydentherapper
Copy link
Contributor Author

It doesn't look like I have the permission to retrigger the Action workflow, can a maintainer? I can't repro the test failure locally.

@dlorenc
Copy link
Member

dlorenc commented Aug 23, 2022

"PRIVATE KEY" can begin blocks for arbitrary key types, yes? Is there an RFC which disambiguates them?

There's no RFC here, it's very much just convention unfortunately. From this amazing blog post:
https://smallstep.com/blog/everything-pki/

If you’re lucky RFC 7468 will give good guidance to figure out what your PEM payload is. Elliptic curve keys are usually labeled as such, though there doesn’t seem to be any standardization. Other keys are simply “PRIVATE KEY” by PEM. This usually indicates a PKCS#8 payload, an envelope for private keys that includes key type and other metadata. Here’s an example of a PEM-encoded elliptic curve key:

@dekkagaijin
Copy link
Member

Fair enough. Security libraries can have a little parsing ambiguity, as a treat :p

@dekkagaijin dekkagaijin merged commit 6450063 into sigstore:main Aug 23, 2022
mtrmac pushed a commit to mtrmac/sigstore that referenced this pull request Mar 10, 2023
Signed-off-by: Matt Moore <mattomata@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants