[−][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]
pub fn clone(&self) -> SessionKey
[src]
pub 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], Global>> for SessionKey
[src]
impl From<Protected> for SessionKey
[src]
impl From<Vec<u8, Global>> for SessionKey
[src]
impl PartialEq<SessionKey> for SessionKey
[src]
pub fn eq(&self, other: &SessionKey) -> bool
[src]
pub fn ne(&self, other: &SessionKey) -> bool
[src]
impl StructuralEq for SessionKey
[src]
impl StructuralPartialEq for SessionKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionKey
[src]
impl Send for SessionKey
[src]
impl Sync for SessionKey
[src]
impl Unpin for SessionKey
[src]
impl UnwindSafe for SessionKey
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,