Struct jwt_compact::alg::RsaPrivateKey [−][src]
pub struct RsaPrivateKey { /* fields omitted */ }
with_rsa
only.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
.
pub fn new_with_exp<R>(
rng: &mut R,
bit_size: usize,
exp: &BigUint
) -> Result<RsaPrivateKey, Error> where
R: Rng,
pub fn new_with_exp<R>(
rng: &mut R,
bit_size: usize,
exp: &BigUint
) -> Result<RsaPrivateKey, Error> where
R: 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.
pub fn from_components(
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint, Global>
) -> RsaPrivateKey
pub fn from_components(
n: BigUint,
e: BigUint,
d: BigUint,
primes: Vec<BigUint, Global>
) -> RsaPrivateKey
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 occationally be useful to discard the private information entirely.
Performs some calculations to speed up private key operations.
Performs basic sanity checks on the key.
Returns Ok(())
if everything is good, otherwise an approriate error.
Decrypt the given message.
Decrypt the given message.
Uses rng
to blind the decryption process.
Sign the given digest.
Trait Implementations
type Target = RsaPublicKey
type Target = RsaPublicKey
The resulting type after dereferencing.
Dereferences the value.
Performs the conversion.
⚠ Warning. Contrary to RFC 7518, this implementation does not set dp
, dq
, and qi
fields in the JWK root object, as well as d
and t
fields for additional factors
(i.e., in the oth
array).
Performs the conversion.
Performs the conversion.
Parse the RsaPrivateKey
from a PKCS#1-encoded document.
Serialize a RsaPrivateKeyDocument
containing a PKCS#1-encoded private key.
⚠ Warning. Contrary to [RFC 7518] (at least, in spirit), this conversion ignores
dp
, dq
, and qi
fields from JWK, as well as d
and t
fields for additional factors.
type Error = WeakKeyError<RsaPrivateKey>
type Error = WeakKeyError<RsaPrivateKey>
The type returned in the event of a conversion error.
Performs the conversion.
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
.
Serialize a PrivateKeyDocument
containing a PKCS#8-encoded private key.