MCPcopy Create free account
hub / github.com/actix/examples / load_certified_key

Function load_certified_key

https-tls/hot-reload/src/main.rs:80–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78}
79
80fn load_certified_key() -> eyre::Result<rustls::sign::CertifiedKey> {
81 // load TLS key/cert files
82 let cert_chain = CertificateDer::pem_file_iter("cert.pem")
83 .wrap_err("Could not locate certificate chain file")?
84 .flatten()
85 .collect();
86
87 // load TLS private key file
88 let key =
89 PrivateKeyDer::from_pem_file("key.pem").wrap_err("Could not locate PKCS 8 private keys")?;
90
91 // parse private key by crypto provider
92 let key = rustls::crypto::aws_lc_rs::sign::any_supported_type(&key)
93 .wrap_err("Private key type is unsupported")?;
94
95 Ok(CertifiedKey::new(cert_chain, key))
96}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected