logo
pub struct RsaPrivateKey { /* private fields */ }
Expand description

Represents a whole RSA key, public and private parts.

Implementations

Generate a new Rsa key pair of the given bit size using the passed in rng.

Generate a new RSA key pair of the given bit size and the public exponent using the passed in rng.

Unless you have specific needs, you should use RsaPrivateKey::new instead.

Constructs an RSA key pair from the individual components.

Get the public key from the private key, cloning n and e.

Generally this is not needed since RsaPrivateKey implements the PublicKey trait, but it can occasionally be useful to discard the private information entirely.

Performs some calculations to speed up private key operations.

Clears precomputed values by setting to None

Returns the private exponent of the key.

Returns the prime factors.

Compute CRT coefficient: (1/q) mod p.

Performs basic sanity checks on the key. Returns Ok(()) if everything is good, otherwise an appropriate error.

Decrypt the given message.

Decrypt the given message.

Uses rng to blind the decryption process.

Sign the given digest.

Sign the given digest using the provided rng

Use rng for signature process.

Sign the given digest.

Use rng for blinding.

Methods from Deref<Target = RsaPublicKey>

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format). Read more
Deserialize PKCS#8-encoded private key from PEM. Read more
Load PKCS#8 private key from an ASN.1 DER-encoded file on the local filesystem (binary format). Read more
Load PKCS#8 private key from a PEM-encoded file on the local filesystem.
The resulting type after dereferencing.
Dereferences the value.
Deserialize this value from the given Serde deserializer. Read more
Executes the destructor for this type. Read more
Serialize a [SecretDocument] containing a PKCS#8-encoded private key.
Serialize this private key as PEM-encoded PKCS#8 with the given [LineEnding].
Write ASN.1 DER-encoded PKCS#8 private key to the given path
Write ASN.1 DER-encoded PKCS#8 private key to the given path
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Returns the modulus of the key.
Returns the public exponent of the key.
Returns the modulus size in bytes. Raw signatures and ciphertexts for or by this public key will have the same size. Read more
Serialize this value into the given Serde serializer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Deserialize PKCS#1 private key from ASN.1 DER-encoded data (binary format). Read more
Deserialize PKCS#1-encoded private key from PEM. Read more
Load PKCS#1 private key from an ASN.1 DER-encoded file on the local filesystem (binary format). Read more
Load PKCS#1 private key from a PEM-encoded file on the local filesystem.
Serialize a [SecretDocument] containing a PKCS#1-encoded private key.
Serialize this private key as PEM-encoded PKCS#1 with the given [LineEnding].
Write ASN.1 DER-encoded PKCS#1 private key to the given path.
Write ASN.1 DER-encoded PKCS#1 private key to the given path.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.