Skip to content

Introduce API to parse PEM keys in a simpler way#1305

Open
DoumanAsh wants to merge 1 commit intoRustCrypto:masterfrom
DoumanAsh:introduce_generic_pem_parse
Open

Introduce API to parse PEM keys in a simpler way#1305
DoumanAsh wants to merge 1 commit intoRustCrypto:masterfrom
DoumanAsh:introduce_generic_pem_parse

Conversation

@DoumanAsh
Copy link
Copy Markdown

As per idea from RustCrypto/elliptic-curves#1733 (comment)

There is too many micro dependencies between each other but...
I cooked up SigningKey::from_pem method that parses PEM content depending on label as simple as possible
At the end of the day it requires pem, der and optionally pkcs8 with alloc
I initially thought sec1 lives on its own, but right now it seems to be Interleaved with pkcs8 so I could make it required feature instead since there is not much benefit in having code path for builds that don't have pkcs8 with alloc

@tarcieri
Copy link
Copy Markdown
Member

This should probably go in elliptic-curve and be defined on SecretKey, then ecdsa can delegate to that

@DoumanAsh
Copy link
Copy Markdown
Author

Created PR
RustCrypto/traits#2387

I see that it prefers to hide error meaning, but for now I think this case would benefit from having proper error to indicate what exactly is wrong, but let me know if I need to hide error anyway

tarcieri added a commit to RustCrypto/traits that referenced this pull request Apr 16, 2026
As suggested in RustCrypto/signatures#1305
created API to decode SecretKey from variety of PEM encodings

---------

Co-authored-by: Tony Arcieri <bascule@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.

2 participants