hickory_proto::rustls::tls_server

Function read_key

Source
pub fn read_key(path: &Path) -> Result<PrivateKeyDer<'static>, ProtoError>
Available on crate feature dns-over-rustls only.
Expand description

Reads a private key from a PEM-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