Function rsa_der::public_key_from_der [−][src]
Expand description
Decodes a DER-encoded public key into the raw
n
and e
components.
The returned tuple is in the form (n, e)
, where n
and e
are both big-endian big integers representing the key modulus
and exponent, respectively.
Examples
Parsing DER bytes into a public RSA key usable with the
rsa
crate:
use rsa::RSAPublicKey;
use num_bigint_dig::BigUint;
let bytes: &[u8] = get_der_bytes();
let (n, e) = rsa_der::public_key_from_der(bytes)?;
let key = RSAPublicKey::new(BigUint::from_bytes_be(&n), BigUint::from_bytes_be(&e));