[−][src]Struct sequoia_openpgp::crypto::SessionKey
Holds a session key.
The session key is cleared when dropped. Sequoia uses this type to ensure that session keys are not left in memory returned to the allocator.
Session keys can be generated using SessionKey::new
, or
converted from various types using From
.
Implementations
impl SessionKey
[src]
pub fn new(size: usize) -> Self
[src]
Creates a new session key.
Creates a new session key size
bytes in length initialized
using a strong cryptographic number generator.
Examples
This creates a session key and encrypts it for a given
recipient key producing a PKESK
packet.
use sequoia_openpgp as openpgp; use openpgp::types::{Curve, SymmetricAlgorithm}; use openpgp::crypto::SessionKey; use openpgp::packet::prelude::*; let cipher = SymmetricAlgorithm::AES256; let sk = SessionKey::new(cipher.key_size().unwrap()); let key: Key<key::SecretParts, key::UnspecifiedRole> = Key4::generate_ecc(false, Curve::Cv25519)?.into(); let pkesk: PKESK = PKESK3::for_recipient(cipher, &sk, &key)?.into();
Trait Implementations
impl AsMut<[u8]> for SessionKey
[src]
impl AsRef<[u8]> for SessionKey
[src]
impl Clone for SessionKey
[src]
fn clone(&self) -> SessionKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SessionKey
[src]
impl Deref for SessionKey
[src]
impl DerefMut for SessionKey
[src]
impl Eq for SessionKey
[src]
impl<'_> From<&'_ [u8]> for SessionKey
[src]
impl From<Box<[u8]>> for SessionKey
[src]
impl From<Protected> for SessionKey
[src]
impl From<Vec<u8>> for SessionKey
[src]
impl PartialEq<SessionKey> for SessionKey
[src]
fn eq(&self, other: &SessionKey) -> bool
[src]
fn ne(&self, other: &SessionKey) -> bool
[src]
impl StructuralEq for SessionKey
[src]
impl StructuralPartialEq for SessionKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionKey
impl Send for SessionKey
impl Sync for SessionKey
impl Unpin for SessionKey
impl UnwindSafe for SessionKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,