Enum sequoia_openpgp::crypto::mpi::PublicKey
source · #[non_exhaustive]pub enum PublicKey {
RSA {
e: MPI,
n: MPI,
},
DSA {
p: MPI,
q: MPI,
g: MPI,
y: MPI,
},
ElGamal {
p: MPI,
g: MPI,
y: MPI,
},
EdDSA {
curve: Curve,
q: MPI,
},
ECDSA {
curve: Curve,
q: MPI,
},
ECDH {
curve: Curve,
q: MPI,
hash: HashAlgorithm,
sym: SymmetricAlgorithm,
},
Unknown {
mpis: Box<[MPI]>,
rest: Box<[u8]>,
},
}
Expand description
A public key.
Provides a typed and structured way of storing multiple MPIs (and
the occasional elliptic curve) in Key
packets.
Note: This enum cannot be exhaustively matched to allow future extensions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RSA
RSA public key.
DSA
NIST DSA public key.
Fields
ElGamal
ElGamal public key.
EdDSA
DJB’s “Twisted” Edwards curve DSA public key.
ECDSA
NIST’s Elliptic Curve DSA public key.
ECDH
Elliptic Curve Diffie-Hellman public key.
Fields
hash: HashAlgorithm
Algorithm used to derive the Key Encapsulation Key.
sym: SymmetricAlgorithm
Algorithm used to encapsulate the session key.
Unknown
Unknown number of MPIs for an unknown algorithm.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn bits(&self) -> Option<usize>
pub fn bits(&self) -> Option<usize>
Returns the length of the public key in bits.
For finite field crypto this returns the size of the field we
operate in, for ECC it returns Curve::bits()
.
Note: This information is useless and should not be used to gauge the security of a particular key. This function exists only because some legacy PGP application like HKP need it.
Returns None
for unknown keys and curves.
sourcepub fn algo(&self) -> Option<PublicKeyAlgorithm>
pub fn algo(&self) -> Option<PublicKeyAlgorithm>
Returns, if known, the public-key algorithm for this public key.
Trait Implementations§
source§impl MarshalInto for PublicKey
impl MarshalInto for PublicKey
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 PublicKey
impl Ord for PublicKey
source§impl PartialEq for PublicKey
impl PartialEq for PublicKey
source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
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 moreimpl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)