logo
pub struct RsaPrivateKey<'a> {
    pub version: Version,
    pub modulus: UIntBytes<'a>,
    pub public_exponent: UIntBytes<'a>,
    pub private_exponent: UIntBytes<'a>,
    pub prime1: UIntBytes<'a>,
    pub prime2: UIntBytes<'a>,
    pub exponent1: UIntBytes<'a>,
    pub exponent2: UIntBytes<'a>,
    pub coefficient: UIntBytes<'a>,
}
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
}

Fields

version: Version

Version number: two-prime or multi

modulus: UIntBytes<'a>

n: RSA modulus

public_exponent: UIntBytes<'a>

e: RSA public exponent

private_exponent: UIntBytes<'a>

d: RSA private exponent

prime1: UIntBytes<'a>

p: first prime factor of n

prime2: UIntBytes<'a>

q: Second prime factor of n

exponent1: UIntBytes<'a>

First exponent: d mod (p-1)

exponent2: UIntBytes<'a>

Second exponent: d mod (q-1)

coefficient: UIntBytes<'a>

CRT coefficient: (inverse of q) mod p

Implementations

Get the public key that corresponds to this RsaPrivateKey.

Encode this RsaPrivateKey as ASN.1 DER.

Encode this RsaPrivateKey as PEM-encoded ASN.1 DER.

Encode this RsaPrivateKey as PEM-encoded ASN.1 DER using the given LineEnding.

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Call the provided function with a slice of Encodable trait objects representing the fields of this message. 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.

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

Is the provided Tag decodable as a variant of this CHOICE?

Attempt to decode this message using the provided decoder.

Parse Self from the provided DER-encoded byte slice.

Compute the length of this value in bytes when encoded as ASN.1 DER.

Encode this value as ASN.1 DER using the provided Encoder.

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more

Encode this message as ASN.1 DER, appending it to the provided byte vector. Read more

Serialize this message as a byte vector.

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

ASN.1 tag

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.