Struct sequoia_openpgp::crypto::KeyPair [−][src]
pub struct KeyPair { /* fields omitted */ }
Expand description
A cryptographic key pair.
A KeyPair
is a combination of public and secret key. If both
are available in memory, a KeyPair
is a convenient
implementation of Signer
and Decryptor
.
Examples
use sequoia_openpgp as openpgp; use openpgp::types::Curve; use openpgp::cert::prelude::*; use openpgp::packet::prelude::*; // Conveniently create a KeyPair from a bare key: let keypair = Key4::<_, key::UnspecifiedRole>::generate_ecc(false, Curve::Cv25519)? .into_keypair()?; // Or from a query over a certificate: let (cert, _) = CertBuilder::general_purpose(None, Some("alice@example.org")) .generate()?; let keypair = cert.keys().unencrypted_secret().nth(0).unwrap().key().clone() .into_keypair()?;
Implementations
Creates a new key pair.
Returns a reference to the public key.
Returns a reference to the secret key.
Trait Implementations
Returns a reference to the public key.
fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>
[src]
fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>
[src]Decrypts ciphertext
, returning the plain session key.
Auto Trait Implementations
impl RefUnwindSafe for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self