Enum sequoia_openpgp::types::AEADAlgorithm
source · #[non_exhaustive]pub enum AEADAlgorithm {
EAX,
OCB,
GCM,
Private(u8),
Unknown(u8),
}
Expand description
The AEAD algorithms as defined in Section 9.6 of RFC 4880bis.
The values can be converted into and from their corresponding values of the serialized format.
Use AEADAlgorithm::from
to translate a numeric value to a
symbolic one.
Note: This enum cannot be exhaustively matched to allow future extensions.
This feature is experimental.
§Examples
Use AEADAlgorithm
to set the preferred AEAD algorithms on a signature:
use sequoia_openpgp as openpgp;
use openpgp::packet::signature::SignatureBuilder;
use openpgp::types::{Features, HashAlgorithm, AEADAlgorithm, SignatureType};
let features = Features::empty().set_aead();
let mut builder = SignatureBuilder::new(SignatureType::DirectKey)
.set_features(features)?
.set_preferred_aead_algorithms(vec![
AEADAlgorithm::EAX,
])?;
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EAX
EAX mode.
OCB
OCB mode.
GCM
Galois/Counter mode.
Private(u8)
Private algorithm identifier.
Unknown(u8)
Unknown algorithm identifier.
Implementations§
source§impl AEADAlgorithm
impl AEADAlgorithm
sourcepub fn digest_size(&self) -> Result<usize>
pub fn digest_size(&self) -> Result<usize>
Returns the digest size of the AEAD algorithm.
sourcepub fn nonce_size(&self) -> Result<usize>
pub fn nonce_size(&self) -> Result<usize>
Returns the nonce size of the AEAD algorithm.
sourcepub fn iv_size(&self) -> Result<usize>
👎Deprecated: Use nonce_size
pub fn iv_size(&self) -> Result<usize>
Returns the initialization vector size of the AEAD algorithm.
This function is deprecated. Please use
AEADAlgorithm::nonce_size
.
source§impl AEADAlgorithm
impl AEADAlgorithm
sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Returns whether this algorithm is supported.
§Examples
use sequoia_openpgp as openpgp;
use openpgp::types::AEADAlgorithm;
assert!(! AEADAlgorithm::Private(100).is_supported());
sourcepub fn variants() -> impl Iterator<Item = Self>
pub fn variants() -> impl Iterator<Item = Self>
Returns an iterator over all valid variants.
Returns an iterator over all known variants. This does not
include the AEADAlgorithm::Private
, or
AEADAlgorithm::Unknown
variants.
Trait Implementations§
source§impl Clone for AEADAlgorithm
impl Clone for AEADAlgorithm
source§fn clone(&self) -> AEADAlgorithm
fn clone(&self) -> AEADAlgorithm
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AEADAlgorithm
impl Debug for AEADAlgorithm
source§impl Default for AEADAlgorithm
impl Default for AEADAlgorithm
source§impl Display for AEADAlgorithm
impl Display for AEADAlgorithm
Formats the AEAD algorithm name.
There are two ways the AEAD algorithm name can be formatted. By default the short name is used. The alternate format uses the full algorithm name.
§Examples
use sequoia_openpgp as openpgp;
use openpgp::types::AEADAlgorithm;
// default, short format
assert_eq!("EAX", format!("{}", AEADAlgorithm::EAX));
// alternate, long format
assert_eq!("EAX mode", format!("{:#}", AEADAlgorithm::EAX));
source§impl From<AEADAlgorithm> for u8
impl From<AEADAlgorithm> for u8
source§fn from(s: AEADAlgorithm) -> u8
fn from(s: AEADAlgorithm) -> u8
source§impl From<u8> for AEADAlgorithm
impl From<u8> for AEADAlgorithm
source§impl Hash for AEADAlgorithm
impl Hash for AEADAlgorithm
source§impl Ord for AEADAlgorithm
impl Ord for AEADAlgorithm
source§fn cmp(&self, other: &AEADAlgorithm) -> Ordering
fn cmp(&self, other: &AEADAlgorithm) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AEADAlgorithm
impl PartialEq for AEADAlgorithm
source§fn eq(&self, other: &AEADAlgorithm) -> bool
fn eq(&self, other: &AEADAlgorithm) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AEADAlgorithm
impl PartialOrd for AEADAlgorithm
source§fn partial_cmp(&self, other: &AEADAlgorithm) -> Option<Ordering>
fn partial_cmp(&self, other: &AEADAlgorithm) -> Option<Ordering>
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 Copy for AEADAlgorithm
impl Eq for AEADAlgorithm
impl StructuralPartialEq for AEADAlgorithm
Auto Trait Implementations§
impl Freeze for AEADAlgorithm
impl RefUnwindSafe for AEADAlgorithm
impl Send for AEADAlgorithm
impl Sync for AEADAlgorithm
impl Unpin for AEADAlgorithm
impl UnwindSafe for AEADAlgorithm
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
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)