Enum sequoia_openpgp::crypto::mpi::SecretKeyMaterial
source · #[non_exhaustive]
pub enum SecretKeyMaterial {
RSA {
d: ProtectedMPI,
p: ProtectedMPI,
q: ProtectedMPI,
u: ProtectedMPI,
},
DSA {
x: ProtectedMPI,
},
ElGamal {
x: ProtectedMPI,
},
EdDSA {
scalar: ProtectedMPI,
},
ECDSA {
scalar: ProtectedMPI,
},
ECDH {
scalar: ProtectedMPI,
},
Unknown {
mpis: Box<[ProtectedMPI]>,
rest: Protected,
},
}
Expand description
A secret key.
Provides a typed and structured way of storing multiple MPIs in
Key
packets. Secret key components are protected by storing
them using ProtectedMPI
.
Note: This enum cannot be exhaustively matched to allow future extensions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RSA
Fields
d: ProtectedMPI
Secret exponent, inverse of e in Phi(N).
p: ProtectedMPI
Smaller secret prime.
q: ProtectedMPI
Larger secret prime.
u: ProtectedMPI
Inverse of p mod q.
RSA secret key.
DSA
Fields
x: ProtectedMPI
Secret key log_g(y) in Zp.
NIST DSA secret key.
ElGamal
Fields
x: ProtectedMPI
Secret key log_g(y) in Zp.
ElGamal secret key.
EdDSA
Fields
scalar: ProtectedMPI
Secret scalar.
DJB’s “Twisted” Edwards curve DSA secret key.
ECDSA
Fields
scalar: ProtectedMPI
Secret scalar.
NIST’s Elliptic Curve DSA secret key.
ECDH
Fields
scalar: ProtectedMPI
Secret scalar.
Elliptic Curve Diffie-Hellman public key.
Unknown
Fields
mpis: Box<[ProtectedMPI]>
The successfully parsed MPIs.
Unknown number of MPIs for an unknown algorithm.
Implementations§
source§impl SecretKeyMaterial
impl SecretKeyMaterial
sourcepub fn algo(&self) -> Option<PublicKeyAlgorithm>
pub fn algo(&self) -> Option<PublicKeyAlgorithm>
Returns, if known, the public-key algorithm for this secret key.
source§impl SecretKeyMaterial
impl SecretKeyMaterial
sourcepub fn parse_with_checksum<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R,
checksum: SecretKeyChecksum
) -> Result<Self>
pub fn parse_with_checksum<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R,
checksum: SecretKeyChecksum
) -> Result<Self>
Parses secret key MPIs for algo
plus their SHA1 checksum.
Fails if the checksum is wrong.
sourcepub fn parse<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R
) -> Result<Self>
pub fn parse<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R
) -> Result<Self>
Parses a set of OpenPGP MPIs representing a secret key.
See Section 3.2 of RFC 4880 for details.
source§impl SecretKeyMaterial
impl SecretKeyMaterial
sourcepub fn serialize_with_checksum(
&self,
w: &mut dyn Write,
checksum: SecretKeyChecksum
) -> Result<()>
pub fn serialize_with_checksum(
&self,
w: &mut dyn Write,
checksum: SecretKeyChecksum
) -> Result<()>
Writes this secret key with a checksum to w
.
Trait Implementations§
source§impl Clone for SecretKeyMaterial
impl Clone for SecretKeyMaterial
source§fn clone(&self) -> SecretKeyMaterial
fn clone(&self) -> SecretKeyMaterial
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SecretKeyMaterial
impl Debug for SecretKeyMaterial
source§impl From<SecretKeyMaterial> for SecretKeyMaterial
impl From<SecretKeyMaterial> for SecretKeyMaterial
source§fn from(mpis: SecretKeyMaterial) -> Self
fn from(mpis: SecretKeyMaterial) -> Self
source§impl From<SecretKeyMaterial> for Unencrypted
impl From<SecretKeyMaterial> for Unencrypted
source§fn from(mpis: SecretKeyMaterial) -> Self
fn from(mpis: SecretKeyMaterial) -> Self
source§impl Hash for SecretKeyMaterial
impl Hash for SecretKeyMaterial
source§impl Hash for SecretKeyMaterial
impl Hash for SecretKeyMaterial
source§impl Marshal for SecretKeyMaterial
impl Marshal for SecretKeyMaterial
source§impl MarshalInto for SecretKeyMaterial
impl MarshalInto for SecretKeyMaterial
source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
source§impl Ord for SecretKeyMaterial
impl Ord for SecretKeyMaterial
source§impl PartialEq<SecretKeyMaterial> for SecretKeyMaterial
impl PartialEq<SecretKeyMaterial> for SecretKeyMaterial
source§impl PartialOrd<SecretKeyMaterial> for SecretKeyMaterial
impl PartialOrd<SecretKeyMaterial> for SecretKeyMaterial
source§fn partial_cmp(&self, other: &SecretKeyMaterial) -> Option<Ordering>
fn partial_cmp(&self, other: &SecretKeyMaterial) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more