pub struct PrivateSec1KeyDer<'a>(/* private fields */);展开描述
一份 Sec1 编码的明文私钥;遵循 RFC 5915 的规定
在 PEM 语境中,Sec1 私钥的类型标识为 EC PRIVATE KEY;存储到文件时通常使用 .pem 或 .key 后缀。
更多关于 PEM 文件的信息,请参见本 crate 的文档。
use rustls_pki_types::{PrivateSec1KeyDer, pem::PemObject};
// load from a PEM file
PrivateSec1KeyDer::from_pem_file("tests/data/nistp256key.pem").unwrap();
// or from a PEM byte slice...
PrivateSec1KeyDer::from_pem_slice(byte_slice).unwrap();实现§
Source§impl PrivateSec1KeyDer<'_>
impl PrivateSec1KeyDer<'_>
Sourcepub fn clone_key(&self) -> PrivateSec1KeyDer<'static>
pub fn clone_key(&self) -> PrivateSec1KeyDer<'static>
将该私钥克隆为一个 'static 值
Sourcepub fn secret_sec1_der(&self) -> &[u8] ⓘ
pub fn secret_sec1_der(&self) -> &[u8] ⓘ
产出该私钥 DER 编码后的字节