pub struct RsaPrivateKey<U> {
pub modulus: U,
pub public_exponent: U,
pub private_exponent: U,
pub prime1: U,
pub prime2: U,
pub exponent1: U,
pub exponent2: U,
pub coefficient: U,
pub other_prime_infos: Option<OtherPrimeInfos<U>>,
}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
}
OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfoNote: the version field is selected automatically based on the absence or
presence of the other_prime_infos field.
Fields§
§modulus: Un: RSA modulus.
public_exponent: Ue: RSA public exponent.
private_exponent: Ud: RSA private exponent.
prime1: Up: first prime factor of n.
prime2: Uq: Second prime factor of n.
exponent1: UFirst exponent: d mod (p-1).
exponent2: USecond exponent: d mod (q-1).
coefficient: UCRT coefficient: (inverse of q) mod p.
other_prime_infos: Option<OtherPrimeInfos<U>>Additional primes r_3, …, r_u, in order, if this is a multi-prime
RSA key (i.e. version is multi).
Implementations§
Source§impl<U> RsaPrivateKey<U>where
U: AsUintRef,
impl<U> RsaPrivateKey<U>where
U: AsUintRef,
Sourcepub fn public_key<'a>(&'a self) -> RsaPublicKeyRef<'a>
pub fn public_key<'a>(&'a self) -> RsaPublicKeyRef<'a>
Get the public key that corresponds to this RsaPrivateKey.
Source§impl<U> RsaPrivateKey<U>
impl<U> RsaPrivateKey<U>
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<U: Clone> Clone for RsaPrivateKey<U>
impl<U: Clone> Clone for RsaPrivateKey<U>
Source§fn clone(&self) -> RsaPrivateKey<U>
fn clone(&self) -> RsaPrivateKey<U>
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 moreSource§impl<U> Debug for RsaPrivateKey<U>where
U: Debug,
impl<U> Debug for RsaPrivateKey<U>where
U: Debug,
Source§impl<'a, U> DecodeValue<'a> for RsaPrivateKey<U>
impl<'a, U> DecodeValue<'a> for RsaPrivateKey<U>
Source§impl<U> EncodeValue for RsaPrivateKey<U>where
U: Encode,
impl<U> EncodeValue for RsaPrivateKey<U>where
U: Encode,
Source§impl<'a, U> From<&'a RsaPrivateKey<U>> for RsaPublicKeyRef<'a>where
U: AsUintRef,
impl<'a, U> From<&'a RsaPrivateKey<U>> for RsaPublicKeyRef<'a>where
U: AsUintRef,
Source§fn from(private_key: &'a RsaPrivateKey<U>) -> RsaPublicKeyRef<'a>
fn from(private_key: &'a RsaPrivateKey<U>) -> RsaPublicKeyRef<'a>
Converts to this type from the input type.
Source§impl<U> PemLabel for RsaPrivateKey<U>
Available on crate feature pem only.
impl<U> PemLabel for RsaPrivateKey<U>
Available on crate feature
pem only.Source§impl<'a, U> TryFrom<&'a [u8]> for RsaPrivateKey<U>
impl<'a, U> TryFrom<&'a [u8]> for RsaPrivateKey<U>
Source§impl<'a, U> TryFrom<&'a OctetStringRef> for RsaPrivateKey<U>
impl<'a, U> TryFrom<&'a OctetStringRef> for RsaPrivateKey<U>
Source§impl<U> TryFrom<&RsaPrivateKey<U>> for SecretDocumentwhere
U: Encode,
Available on crate feature alloc only.
impl<U> TryFrom<&RsaPrivateKey<U>> for SecretDocumentwhere
U: Encode,
Available on crate feature
alloc only.Source§fn try_from(private_key: &RsaPrivateKey<U>) -> Result<SecretDocument>
fn try_from(private_key: &RsaPrivateKey<U>) -> Result<SecretDocument>
Performs the conversion.
Source§impl<U> TryFrom<RsaPrivateKey<U>> for SecretDocumentwhere
U: Encode,
Available on crate feature alloc only.
impl<U> TryFrom<RsaPrivateKey<U>> for SecretDocumentwhere
U: Encode,
Available on crate feature
alloc only.Source§fn try_from(private_key: RsaPrivateKey<U>) -> Result<SecretDocument>
fn try_from(private_key: RsaPrivateKey<U>) -> Result<SecretDocument>
Performs the conversion.
impl<U> Sequence<'_> for RsaPrivateKey<U>
Auto Trait Implementations§
impl<U> Freeze for RsaPrivateKey<U>where
U: Freeze,
impl<U> RefUnwindSafe for RsaPrivateKey<U>where
U: RefUnwindSafe,
impl<U> Send for RsaPrivateKey<U>where
U: Send,
impl<U> Sync for RsaPrivateKey<U>where
U: Sync,
impl<U> Unpin for RsaPrivateKey<U>where
U: Unpin,
impl<U> UnsafeUnpin for RsaPrivateKey<U>where
U: UnsafeUnpin,
impl<U> UnwindSafe for RsaPrivateKey<U>where
U: UnwindSafe,
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