Enum sequoia_openpgp::crypto::mpi::PublicKey [−][src]
#[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]>, }, }
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)
RSA public key.
NIST DSA public key.
Show fields
ElGamal public key.
Show fields
DJBs “Twisted” Edwards curve DSA public key.
NISTs Elliptic curve DSA public key.
Elliptic curve ElGamal public key.
Show fields
Fields of ECDH
curve: Curve
Curve we’re using.
q: MPI
Public point.
hash: HashAlgorithm
Hash algorithm used for key derivation.
sym: SymmetricAlgorithm
Algorithm used w/the derived key.
Unknown number of MPIs for an unknown algorithm.
Show fields
Implementations
impl PublicKey
[src]
impl PublicKey
[src]pub fn bits(&self) -> Option<usize>
[src]
pub fn bits(&self) -> Option<usize>
[src]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.
pub fn algo(&self) -> Option<PublicKeyAlgorithm>
[src]
pub fn algo(&self) -> Option<PublicKeyAlgorithm>
[src]Returns, if known, the public-key algorithm for this public key.
impl PublicKey
[src]
impl PublicKey
[src]pub fn parse<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R
) -> Result<Self>
[src]
pub fn parse<R: Read + Send + Sync>(
algo: PublicKeyAlgorithm,
reader: R
) -> Result<Self>
[src]Parses a set of OpenPGP MPIs representing a public key.
See Section 3.2 of RFC 4880 for details.
Trait Implementations
impl MarshalInto for PublicKey
[src]
impl MarshalInto for PublicKey
[src]impl Ord for PublicKey
[src]
impl Ord for PublicKey
[src]impl PartialOrd<PublicKey> for PublicKey
[src]
impl PartialOrd<PublicKey> for PublicKey
[src]fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for PublicKey
[src]
impl StructuralEq for PublicKey
[src]
impl StructuralPartialEq for PublicKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more