Crate rsa_der[][src]

Expand description

A simple crate to encode and decode DER-formatted public RSA keys.

Public keys are passed to and returned from functions simply using the n and e components, so any RSA library can be used in conjunction with this crate.


Convert an RSA public key to DER bytes:

use rand::rngs::OsRng;

let key = generate_key();
let der_bytes = rsa_der::public_key_to_der(&key.n().to_bytes_be(), &key.e().to_bytes_be());


Error type for rsa-der.


Decodes a DER-encoded public key into the raw n and e components.

Encodes an RSA public key to DER bytes, as specified by the PKCS#8 format.

Type Definitions

Result type for rsa-der. This type is equivalent to std::result::Result<T, rsa_der::Error>.