[][src]Trait mundane::public::DerPrivateKey

pub trait DerPrivateKey: PrivateKey + DerKey {
#[must_use]
    fn marshal_to_der(&self) -> Vec<u8> { ... }
#[must_use] fn parse_from_der(bytes: &[u8]) -> Result<Self, Error> { ... } }

A private key which can be encoded as a DER object.

Provided methods

#[must_use] fn marshal_to_der(&self) -> Vec<u8>

Marshals a private key in DER format.

marshal_to_der marshal a private key as a DER-encoded structure. The exact structure encoded depends on the type of key:

  • For an EC key, it is an ECPrivateKey structure as defined in RFC 5915.
  • For an RSA key, it is an RSAPrivateKey structure as defined in RFC 3447.

#[must_use] fn parse_from_der(bytes: &[u8]) -> Result<Self, Error>

Parses a private key in DER format.

parse_from_der parses a private key from a DER-encoded format. The exact structure expected depends on the type of key:

  • For an EC key, it is an ECPrivateKey structure as defined in RFC 5915.
  • For an RSA key, it is an RSAPrivateKey structure as defined in RFC 3447.

Elliptic Curve Keys

For Elliptic Curve keys (EcPrivKey), the curve itself is validated. If the curve is not known ahead of time, and any curve must be supported at runtime, use the EcPrivKeyAnyCurve::parse_from_der function.

Loading content...

Implementors

impl<B: RsaKeyBits> DerPrivateKey for RsaPrivKey<B>[src]

impl<C: PCurve> DerPrivateKey for EcPrivKey<C>[src]

Loading content...