pub struct PrivateKey(PrivateKey);Expand description
RSA private key.
Tuple Fields§
§0: PrivateKeyImplementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn from_pkcs8_der(der: &[u8]) -> Result<Self, Error>
pub fn from_pkcs8_der(der: &[u8]) -> Result<Self, Error>
Parses a PKCS#8 PrivateKeyInfo.
Sourcepub fn from_pkcs8_pem(pem: &str) -> Result<Self, Error>
pub fn from_pkcs8_pem(pem: &str) -> Result<Self, Error>
Parses a PEM-armored PKCS#8 PrivateKeyInfo (-----BEGIN PRIVATE KEY-----).
Sourcepub fn from_pkcs1_der(der: &[u8]) -> Result<Self, Error>
pub fn from_pkcs1_der(der: &[u8]) -> Result<Self, Error>
Parses a PKCS#1 RSAPrivateKey.
Sourcepub fn from_components(
n: &[u8],
e: &[u8],
d: &[u8],
primes: &[&[u8]],
) -> Result<Self, Error>
pub fn from_components( n: &[u8], e: &[u8], d: &[u8], primes: &[&[u8]], ) -> Result<Self, Error>
Builds a two-prime key from big-endian components and validates it. primes must hold
exactly p and q.
Sourcepub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, Error>
pub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, Error>
Serializes as PKCS#8 PrivateKeyInfo.
Sourcepub fn components(&self) -> PrivateComponents
pub fn components(&self) -> PrivateComponents
Returns the key components.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the matching public key.
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl ZeroizeOnDrop for PrivateKeywhere
PrivateKey: ZeroizeOnDrop,
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnsafeUnpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more