pub struct RsaPrivateKey<'a> {
pub modulus: UintRef<'a>,
pub public_exponent: UintRef<'a>,
pub private_exponent: UintRef<'a>,
pub prime1: UintRef<'a>,
pub prime2: UintRef<'a>,
pub exponent1: UintRef<'a>,
pub exponent2: UintRef<'a>,
pub coefficient: UintRef<'a>,
pub other_prime_infos: Option<OtherPrimeInfos<'a>>,
}Expand description
PKCS#1 RSA Private Keys as defined in RFC 8017 Appendix 1.2.
ASN.1 structure containing a serialized RSA private key:
RSAPrivateKey ::= SEQUENCE {
version Version,
modulus INTEGER, -- n
publicExponent INTEGER, -- e
privateExponent INTEGER, -- d
prime1 INTEGER, -- p
prime2 INTEGER, -- q
exponent1 INTEGER, -- d mod (p-1)
exponent2 INTEGER, -- d mod (q-1)
coefficient INTEGER, -- (inverse of q) mod p
otherPrimeInfos OtherPrimeInfos OPTIONAL
}Note: the version field is selected automatically based on the absence or
presence of the other_prime_infos field.
Fields§
§modulus: UintRef<'a>n: RSA modulus.
public_exponent: UintRef<'a>e: RSA public exponent.
private_exponent: UintRef<'a>d: RSA private exponent.
prime1: UintRef<'a>p: first prime factor of n.
prime2: UintRef<'a>q: Second prime factor of n.
exponent1: UintRef<'a>First exponent: d mod (p-1).
exponent2: UintRef<'a>Second exponent: d mod (q-1).
coefficient: UintRef<'a>CRT coefficient: (inverse of q) mod p.
other_prime_infos: Option<OtherPrimeInfos<'a>>Additional primes r_3, …, r_u, in order, if this is a multi-prime
RSA key (i.e. version is multi).
Implementations§
Source§impl<'a> RsaPrivateKey<'a>
impl<'a> RsaPrivateKey<'a>
Sourcepub fn public_key(&self) -> RsaPublicKey<'a>
pub fn public_key(&self) -> RsaPublicKey<'a>
Get the public key that corresponds to this RsaPrivateKey.
Sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Get the Version for this key.
Determined by the presence or absence of the
RsaPrivateKey::other_prime_infos field.
Trait Implementations§
Source§impl<'a> Clone for RsaPrivateKey<'a>
impl<'a> Clone for RsaPrivateKey<'a>
Source§fn clone(&self) -> RsaPrivateKey<'a>
fn clone(&self) -> RsaPrivateKey<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RsaPrivateKey<'_>
impl Debug for RsaPrivateKey<'_>
Source§impl<'a> DecodeValue<'a> for RsaPrivateKey<'a>
impl<'a> DecodeValue<'a> for RsaPrivateKey<'a>
Source§impl EncodeValue for RsaPrivateKey<'_>
impl EncodeValue for RsaPrivateKey<'_>
Source§impl<'a> From<&RsaPrivateKey<'a>> for RsaPublicKey<'a>
impl<'a> From<&RsaPrivateKey<'a>> for RsaPublicKey<'a>
Source§fn from(private_key: &RsaPrivateKey<'a>) -> RsaPublicKey<'a>
fn from(private_key: &RsaPrivateKey<'a>) -> RsaPublicKey<'a>
Converts to this type from the input type.
Source§impl<'a> From<RsaPrivateKey<'a>> for RsaPublicKey<'a>
impl<'a> From<RsaPrivateKey<'a>> for RsaPublicKey<'a>
Source§fn from(private_key: RsaPrivateKey<'a>) -> RsaPublicKey<'a>
fn from(private_key: RsaPrivateKey<'a>) -> RsaPublicKey<'a>
Converts to this type from the input type.
Source§impl PemLabel for RsaPrivateKey<'_>
Available on crate feature pem only.
impl PemLabel for RsaPrivateKey<'_>
Available on crate feature
pem only.Source§impl<'a> TryFrom<&'a [u8]> for RsaPrivateKey<'a>
impl<'a> TryFrom<&'a [u8]> for RsaPrivateKey<'a>
Source§impl<'a> TryFrom<&'a OctetStringRef> for RsaPrivateKey<'a>
impl<'a> TryFrom<&'a OctetStringRef> for RsaPrivateKey<'a>
Source§impl TryFrom<&RsaPrivateKey<'_>> for SecretDocument
Available on crate feature alloc only.
impl TryFrom<&RsaPrivateKey<'_>> for SecretDocument
Available on crate feature
alloc only.Source§fn try_from(private_key: &RsaPrivateKey<'_>) -> Result<SecretDocument>
fn try_from(private_key: &RsaPrivateKey<'_>) -> Result<SecretDocument>
Performs the conversion.
Source§impl TryFrom<RsaPrivateKey<'_>> for SecretDocument
Available on crate feature alloc only.
impl TryFrom<RsaPrivateKey<'_>> for SecretDocument
Available on crate feature
alloc only.Source§fn try_from(private_key: RsaPrivateKey<'_>) -> Result<SecretDocument>
fn try_from(private_key: RsaPrivateKey<'_>) -> Result<SecretDocument>
Performs the conversion.
impl<'a> Sequence<'a> for RsaPrivateKey<'a>
Auto Trait Implementations§
impl<'a> Freeze for RsaPrivateKey<'a>
impl<'a> RefUnwindSafe for RsaPrivateKey<'a>
impl<'a> Send for RsaPrivateKey<'a>
impl<'a> Sync for RsaPrivateKey<'a>
impl<'a> Unpin for RsaPrivateKey<'a>
impl<'a> UnsafeUnpin for RsaPrivateKey<'a>
impl<'a> UnwindSafe for RsaPrivateKey<'a>
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<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag + 'a,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag + 'a,
Source§type Error = <T as DecodeValue<'a>>::Error
type Error = <T as DecodeValue<'a>>::Error
Type returned in the event of a decoding error.
Source§fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
Attempt to decode this TLV message using the provided decoder. Read more
Source§impl<T> Encode for T
impl<T> Encode for T
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more
Source§impl<T> IsConstructed for T
impl<T> IsConstructed for T
Source§const CONSTRUCTED: bool
const CONSTRUCTED: bool
ASN.1 constructed bit