[−][src]Struct rsa::RSAPrivateKey
Represents a whole RSA key, public and private parts.
Methods
impl RSAPrivateKey
[src]
pub fn new<R: Rng>(rng: &mut R, bit_size: usize) -> Result<RSAPrivateKey>
[src]
Generate a new RSA key pair of the given bit size using the passed in rng
.
pub fn from_components(
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint>
) -> RSAPrivateKey
[src]
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint>
) -> RSAPrivateKey
Constructs an RSA key pair from the individual components.
pub fn to_public_key(&self) -> RSAPublicKey
[src]
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.
pub fn precompute(&mut self)
[src]
Performs some calculations to speed up private key operations.
pub fn d(&self) -> &BigUint
[src]
Returns the private exponent of the key.
pub fn primes(&self) -> &[BigUint]
[src]
Returns the prime factors.
pub fn validate(&self) -> Result<()>
[src]
Performs basic sanity checks on the key.
Returns Ok(())
if everything is good, otherwise an approriate error.
pub fn decrypt(
&self,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
Decrypt the given message.
pub fn decrypt_blinded<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
rng: &mut R,
padding: PaddingScheme,
ciphertext: &[u8]
) -> Result<Vec<u8>>
Decrypt the given message.
Uses rng
to blind the decryption process.
pub fn sign<H: Hash>(
&self,
padding: PaddingScheme,
hash: Option<&H>,
digest: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
padding: PaddingScheme,
hash: Option<&H>,
digest: &[u8]
) -> Result<Vec<u8>>
Sign the given digest.
pub fn sign_blinded<R: Rng, H: Hash>(
&self,
rng: &mut R,
padding: PaddingScheme,
hash: Option<&H>,
digest: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
rng: &mut R,
padding: PaddingScheme,
hash: Option<&H>,
digest: &[u8]
) -> Result<Vec<u8>>
Sign the given digest.
Use rng
for blinding.
Trait Implementations
impl PublicKey for RSAPrivateKey
[src]
fn n(&self) -> &BigUint
[src]
fn e(&self) -> &BigUint
[src]
fn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
fn verify<H: Hash>(
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
[src]
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
fn size(&self) -> usize
[src]
impl<'a> PublicKey for &'a RSAPrivateKey
[src]
fn n(&self) -> &BigUint
[src]
fn e(&self) -> &BigUint
[src]
fn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
fn verify<H: Hash>(
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
[src]
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
fn size(&self) -> usize
[src]
impl Drop for RSAPrivateKey
[src]
impl From<RSAPrivateKey> for RSAPublicKey
[src]
fn from(private_key: RSAPrivateKey) -> Self
[src]
impl Clone for RSAPrivateKey
[src]
fn clone(&self) -> RSAPrivateKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Eq for RSAPrivateKey
[src]
impl PartialEq<RSAPrivateKey> for RSAPrivateKey
[src]
fn eq(&self, other: &RSAPrivateKey) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Debug for RSAPrivateKey
[src]
impl Zeroize for RSAPrivateKey
[src]
Auto Trait Implementations
impl Send for RSAPrivateKey
impl Sync for RSAPrivateKey
impl Unpin for RSAPrivateKey
impl UnwindSafe for RSAPrivateKey
impl RefUnwindSafe for RSAPrivateKey
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,