Enum pgp::crypto::sym::SymmetricKeyAlgorithm [−][src]
#[repr(u8)]
pub enum SymmetricKeyAlgorithm {
Show 13 variants
Plaintext,
IDEA,
TripleDES,
CAST5,
Blowfish,
AES128,
AES192,
AES256,
Twofish,
Camellia128,
Camellia192,
Camellia256,
Private10,
}
Expand description
Available symmetric key algorithms.
Variants
Plaintext or unencrypted data
IDEA
Triple-DES
CAST5
Blowfish
AES with 128-bit key
AES with 192-bit key
AES with 256-bit key
Twofish with 256-bit key
Camellia with 128-bit key
Camellia with 192-bit key
Camellia with 256-bit key
Implementations
The size of a single block in bytes. Based on https://github.com/gpg/libgcrypt/blob/master/cipher
The size of a single block in bytes. Based on https://github.com/gpg/libgcrypt/blob/master/cipher
Decrypt the data using CFB mode, without padding. Overwrites the input. Uses an IV of all zeroes, as specified in the openpgp cfb mode. Does resynchronization.
Decrypt the data using CFB mode, without padding. Overwrites the input. Uses an IV of all zeroes, as specified in the openpgp cfb mode. Does not do resynchronization.
Decrypt the data using CFB mode, without padding. Overwrites the input.
OpenPGP CFB mode uses an initialization vector (IV) of all zeros, and prefixes the plaintext with BS+2 octets of random data, such that octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB resynchronization after encrypting those BS+2 octets.
Thus, for an algorithm that has a block size of 8 octets (64 bits), the IV is 10 octets long and octets 7 and 8 of the IV are the same as octets 9 and 10. For an algorithm with a block size of 16 octets (128 bits), the IV is 18 octets long, and octets 17 and 18 replicate octets 15 and 16. Those extra two octets are an easy check for a correct key.
Decrypt the data using CFB mode, without padding. Overwrites the input. This is regular CFB, not OpenPgP CFB.
Encrypt the data using CFB mode, without padding. Overwrites the input. Uses an IV of all zeroes, as specified in the openpgp cfb mode.
Same as encrypt_with_rng
, but uses rand::thread_rng
for RNG.
pub fn encrypt_protected_with_rng<'a, R: CryptoRng + Rng>(
self,
rng: &mut R,
key: &[u8],
plaintext: &'a [u8]
) -> Result<Vec<u8>>
Encrypt the data using CFB mode, without padding. Overwrites the input.
OpenPGP CFB mode uses an initialization vector (IV) of all zeros, and prefixes the plaintext with BS+2 octets of random data, such that octets BS+1 and BS+2 match octets BS-1 and BS. It does a CFB resynchronization after encrypting those BS+2 octets.
Encrypt the data using CFB mode, without padding. Overwrites the input.
Trait Implementations
Converts an i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts a usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts a f32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Auto Trait Implementations
impl RefUnwindSafe for SymmetricKeyAlgorithm
impl Send for SymmetricKeyAlgorithm
impl Sync for SymmetricKeyAlgorithm
impl Unpin for SymmetricKeyAlgorithm
impl UnwindSafe for SymmetricKeyAlgorithm
Blanket Implementations
Mutably borrows from an owned value. Read more
Called to initialize a place to a valid value, after it is set to all-bits-zero. Read more
type Output = T
type Output = T
Should always be Self