Function hickory_proto::rustls::tls_server::read_key_from_der

source ·
pub fn read_key_from_der(path: &Path) -> ProtoResult<PrivateKeyDer<'static>>
Available on crate feature dns-over-rustls only.
Expand description

Reads a private key from a DER-encoded file

§Accepted formats

  • A Sec1-encoded plaintext private key; as specified in RFC5915
  • A DER-encoded plaintext RSA private key; as specified in PKCS#1/RFC3447
  • DER-encoded plaintext private key; as specified in PKCS#8/RFC5958

§Errors

Returns a ProtoError in either cases:

  • Unable to open key at given path
  • Encountered an IO error
  • Unable to read key: either no key or no key found in the right format