1 unstable release
0.1.0 | Aug 17, 2021 |
---|
#17 in #pem
4,509 downloads per month
Used in 3 crates
(via web-push)
9KB
121 lines
Crate for parsing EcPrivateKey structures as defined in SEC1 section C4. This is the default format generated by openssl for ec keys.
This crate is capable of decoding both PEM and DER encoded keys.
use sec1_decode::parse_pem;
const PEM:&str = "-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIASgox4rXoGc6ajVAjBCsjVIjbfHd8OK3m5v34ZWVBmmoAoGCCqGSM49
AwEHoUQDQgAEUfXAsSR5LH4rVdHbcK1vnYcN9I/6T7u1bl1RprSZFf89aZXL+CeG
G21XVW8IDhjU7HAXgrO1Sqj00zQtluVBTg==
-----END EC PRIVATE KEY-----";
let parsed = parse_pem(PEM.as_bytes()).unwrap();
lib.rs
:
Crate for parsing EcPrivateKey structures as defined in SEC1 section C4. This is the default format generated by openssl for ec keys.
const PEM:&str = "-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIASgox4rXoGc6ajVAjBCsjVIjbfHd8OK3m5v34ZWVBmmoAoGCCqGSM49
AwEHoUQDQgAEUfXAsSR5LH4rVdHbcK1vnYcN9I/6T7u1bl1RprSZFf89aZXL+CeG
G21XVW8IDhjU7HAXgrO1Sqj00zQtluVBTg==
-----END EC PRIVATE KEY-----";
let parsed = parse_pem(PEM.as_bytes()).unwrap();
Dependencies
~4–6MB
~106K SLoC