跳到主要内容

PrivatePkcs1KeyDer

搜索

结构体 PrivatePkcs1KeyDer 

Source
pub struct PrivatePkcs1KeyDer<'a>(/* private fields */);
展开描述

一份 DER 编码的明文 RSA 私钥;遵循 PKCS#1 / RFC 3447 的规定

在 PEM 语境中,RSA 私钥的类型标识为 RSA PRIVATE KEY;存储到文件时通常使用 .pem.key 后缀。

use rustls_pki_types::{PrivatePkcs1KeyDer, pem::PemObject};

// load from a PEM file
PrivatePkcs1KeyDer::from_pem_file("tests/data/rsa1024.pkcs1.pem").unwrap();

// or from a PEM byte slice...
PrivatePkcs1KeyDer::from_pem_slice(byte_slice).unwrap();

实现§

Source§

impl PrivatePkcs1KeyDer<'_>

Source

pub fn clone_key(&self) -> PrivatePkcs1KeyDer<'static>

将该私钥克隆为一个 'static

Source

pub fn secret_pkcs1_der(&self) -> &[u8]

产出该私钥 DER 编码后的字节

trait 实现§

Source§

impl Debug for PrivatePkcs1KeyDer<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化器格式化该值。更多信息
Source§

impl<'a> From<&'a [u8]> for PrivatePkcs1KeyDer<'a>

Source§

fn from(slice: &'a [u8]) -> Self

将该输入类型转换为此类型。
Source§

impl<'a> From<PrivatePkcs1KeyDer<'a>> for PrivateKeyDer<'a>

Source§

fn from(key: PrivatePkcs1KeyDer<'a>) -> Self

将该输入类型转换为此类型。
Source§

impl From<Vec<u8>> for PrivatePkcs1KeyDer<'_>

Available on crate feature alloc only.
Source§

fn from(vec: Vec<u8>) -> Self

将该输入类型转换为此类型。
Source§

impl<'a> PartialEq for PrivatePkcs1KeyDer<'a>

Source§

fn eq(&self, other: &PrivatePkcs1KeyDer<'a>) -> bool

测试 selfother 值是否相等,供 == 使用。
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Zeroize for PrivatePkcs1KeyDer<'static>

Available on crate feature alloc only.
Source§

fn zeroize(&mut self)

使用 Rust intrinsics 将本对象从内存中清零,确保零清除操作不会被编译器“优化掉”。
Source§

impl<'a> Eq for PrivatePkcs1KeyDer<'a>

Source§

impl<'a> StructuralPartialEq for PrivatePkcs1KeyDer<'a>

自动 trait 实现§

blanket 实现§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 更多信息
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. 更多信息
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 更多信息
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回参数。

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

即此转换的实际行为取决于 From<T> for U 的实现。

Source§

impl<T> PemObject for T
where T: PemObjectFilter + From<Vec<u8>>,

Source§

fn from_pem(kind: SectionKind, der: Vec<u8>) -> Option<T>

从 PEM 的 SectionKind 与 body 数据进行转换。更多信息
Source§

fn from_pem_slice(pem: &[u8]) -> Result<Self, Error>

从一段字节切片中的 PEM 数据里,解码出本类型的第一个 section。更多信息
Source§

fn pem_slice_iter(pem: &[u8]) -> SliceIter<'_, Self>

对一段字节切片中的 PEM 数据,迭代出本类型的所有 section。
Source§

fn from_pem_file(file_name: impl AsRef<Path>) -> Result<Self, Error>

从指定文件中的 PEM 内容里,解码出本类型的第一个 section。更多信息
Source§

fn pem_file_iter( file_name: impl AsRef<Path>, ) -> Result<ReadIter<BufReader<File>, Self>, Error>

从指定文件中的 PEM 内容里,迭代出本类型的所有 section。更多信息
Source§

fn from_pem_reader(rd: impl Read) -> Result<Self, Error>

从某个 io::Read 读取的 PEM 中,解码出本类型的第一个 section。
Source§

fn pem_reader_iter<R: Read>(rd: R) -> ReadIter<BufReader<R>, Self>

从某个 io::Read 中的 PEM 数据里,迭代出本类型的所有 section。
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。