Struct rsa::RsaPrivateKey [−][src]
pub struct RsaPrivateKey { /* fields omitted */ }
Expand description
Represents a whole RSA key, public and private parts.
Implementations
This is supported on crate feature alloc
only.
alloc
only.Generate a new Rsa key pair of the given bit size using the passed in rng
.
pub fn new_with_exp<R: Rng>(
rng: &mut R,
bit_size: usize,
exp: &BigUint
) -> Result<RsaPrivateKey>
This is supported on crate feature alloc
only.
pub fn new_with_exp<R: Rng>(
rng: &mut R,
bit_size: usize,
exp: &BigUint
) -> Result<RsaPrivateKey>
alloc
only.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.
pub fn from_components(
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint>
) -> RsaPrivateKey
This is supported on crate feature alloc
only.
pub fn from_components(
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint>
) -> RsaPrivateKey
alloc
only.Constructs an RSA key pair from the individual components.
This is supported on crate feature alloc
only.
alloc
only.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 occationally be useful to discard the private information entirely.
This is supported on crate feature alloc
only.
alloc
only.Performs some calculations to speed up private key operations.
This is supported on crate feature alloc
only.
alloc
only.Returns the private exponent of the key.
This is supported on crate feature alloc
only.
alloc
only.Returns the prime factors.
This is supported on crate feature alloc
only.
alloc
only.Performs basic sanity checks on the key.
Returns Ok(())
if everything is good, otherwise an approriate error.
This is supported on crate feature alloc
only.
alloc
only.Decrypt the given message.
pub fn decrypt_blinded<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
This is supported on crate feature alloc
only.
pub fn decrypt_blinded<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
alloc
only.Decrypt the given message.
Uses rng
to blind the decryption process.
This is supported on crate feature alloc
only.
alloc
only.Sign the given digest.
Methods from Deref<Target = RsaPublicKey>
Trait Implementations
type Target = RsaPublicKey
type Target = RsaPublicKey
The resulting type after dereferencing.
Dereferences the value.
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
Parse the RsaPrivateKey
from a PKCS#1-encoded document.
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 RsaPrivateKeyDocument
containing a PKCS#1-encoded private key.
Serialize this private key as PEM-encoded PKCS#1.
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.
Auto Trait Implementations
impl RefUnwindSafe for RsaPrivateKey
impl Send for RsaPrivateKey
impl Sync for RsaPrivateKey
impl Unpin for RsaPrivateKey
impl UnwindSafe for RsaPrivateKey
Blanket Implementations
Mutably borrows from an owned value. Read more
Parse the PrivateKeyInfo
from a PKCS#8-encoded document.
Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format). Read more
Deserialize PKCS#8 private key from a PrivateKeyDocument
.
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
type Output = T
type Output = T
Should always be Self
Serialize a PrivateKeyDocument
containing a PKCS#8-encoded private key.
Serialize this private key as PEM-encoded PKCS#8.
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