Enum sequoia_openpgp::types::AEADAlgorithm
source · [−]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
sourceimpl 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>
Use nonce_size
Returns the initialization vector size of the AEAD algorithm.
This function is deprecated. Please use
AEADAlgorithm::nonce_size
.
sourceimpl 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
sourceimpl Clone for AEADAlgorithm
impl Clone for AEADAlgorithm
sourcefn clone(&self) -> AEADAlgorithm
fn clone(&self) -> AEADAlgorithm
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AEADAlgorithm
impl Debug for AEADAlgorithm
sourceimpl Default for AEADAlgorithm
impl Default for AEADAlgorithm
sourceimpl 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));
sourceimpl From<AEADAlgorithm> for u8
impl From<AEADAlgorithm> for u8
sourcefn from(s: AEADAlgorithm) -> u8
fn from(s: AEADAlgorithm) -> u8
Converts to this type from the input type.
sourceimpl From<u8> for AEADAlgorithm
impl From<u8> for AEADAlgorithm
sourceimpl Hash for AEADAlgorithm
impl Hash for AEADAlgorithm
sourceimpl Ord for AEADAlgorithm
impl Ord for AEADAlgorithm
sourceimpl PartialEq<AEADAlgorithm> for AEADAlgorithm
impl PartialEq<AEADAlgorithm> for AEADAlgorithm
sourcefn eq(&self, other: &AEADAlgorithm) -> bool
fn eq(&self, other: &AEADAlgorithm) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &AEADAlgorithm) -> bool
fn ne(&self, other: &AEADAlgorithm) -> bool
This method tests for !=
.
sourceimpl PartialOrd<AEADAlgorithm> for AEADAlgorithm
impl PartialOrd<AEADAlgorithm> for AEADAlgorithm
sourcefn partial_cmp(&self, other: &AEADAlgorithm) -> Option<Ordering>
fn partial_cmp(&self, other: &AEADAlgorithm) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for AEADAlgorithm
impl Eq for AEADAlgorithm
impl StructuralEq for AEADAlgorithm
impl StructuralPartialEq for AEADAlgorithm
Auto Trait Implementations
impl RefUnwindSafe for AEADAlgorithm
impl Send for AEADAlgorithm
impl Sync for AEADAlgorithm
impl Unpin for AEADAlgorithm
impl UnwindSafe for AEADAlgorithm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more