#[non_exhaustive]pub enum AEADAlgorithm {
EAX,
OCB,
GCM,
Private(u8),
Unknown(u8),
}
Expand description
AEAD modes.
See AEAD Algorithms for details.
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.
§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::{AEADAlgorithm, Features, SignatureType, SymmetricAlgorithm};
let features = Features::empty().set_seipdv2();
let mut builder = SignatureBuilder::new(SignatureType::DirectKey)
.set_features(features)?
.set_preferred_aead_ciphersuites(vec![
(SymmetricAlgorithm::Camellia128, 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.
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
Formats the AEAD algorithm name.
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));