[−][src]Enum pgp::crypto::sym::SymmetricKeyAlgorithm
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
impl SymmetricKeyAlgorithm
[src]
pub fn block_size(self) -> usize
[src]
The size of a single block in bytes. Based on https://github.com/gpg/libgcrypt/blob/master/cipher
pub fn key_size(self) -> usize
[src]
The size of a single block in bytes. Based on https://github.com/gpg/libgcrypt/blob/master/cipher
pub fn decrypt<'a>(
self,
key: &[u8],
ciphertext: &'a mut [u8]
) -> Result<&'a [u8]>
[src]
self,
key: &[u8],
ciphertext: &'a mut [u8]
) -> Result<&'a [u8]>
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.
pub fn decrypt_protected<'a>(
self,
key: &[u8],
ciphertext: &'a mut [u8]
) -> Result<&'a [u8]>
[src]
self,
key: &[u8],
ciphertext: &'a mut [u8]
) -> Result<&'a [u8]>
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.
pub fn decrypt_with_iv<'a>(
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8],
resync: bool
) -> Result<(&'a [u8], &'a [u8])>
[src]
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8],
resync: bool
) -> Result<(&'a [u8], &'a [u8])>
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.
pub fn decrypt_with_iv_regular<'a>(
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8]
) -> Result<()>
[src]
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8]
) -> Result<()>
Decrypt the data using CFB mode, without padding. Overwrites the input. This is regular CFB, not OpenPgP CFB.
pub fn encrypt_with_rng<R: CryptoRng + Rng>(
self,
rng: &mut R,
key: &[u8],
plaintext: &[u8]
) -> Result<Vec<u8>>
[src]
self,
rng: &mut R,
key: &[u8],
plaintext: &[u8]
) -> Result<Vec<u8>>
Encrypt the data using CFB mode, without padding. Overwrites the input. Uses an IV of all zeroes, as specified in the openpgp cfb mode.
pub fn encrypt(self, key: &[u8], plaintext: &[u8]) -> Result<Vec<u8>>
[src]
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>>
[src]
self,
rng: &mut R,
key: &[u8],
plaintext: &'a [u8]
) -> Result<Vec<u8>>
pub fn encrypt_protected<'a>(
self,
key: &[u8],
plaintext: &'a [u8]
) -> Result<Vec<u8>>
[src]
self,
key: &[u8],
plaintext: &'a [u8]
) -> Result<Vec<u8>>
pub fn encrypt_with_iv<'a>(
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8],
resync: bool
) -> Result<()>
[src]
self,
key: &[u8],
iv_vec: &[u8],
ciphertext: &'a mut [u8],
resync: bool
) -> Result<()>
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.
pub fn encrypt_with_iv_regular(
self,
key: &[u8],
iv_vec: &[u8],
plaintext: &mut [u8]
) -> Result<()>
[src]
self,
key: &[u8],
iv_vec: &[u8],
plaintext: &mut [u8]
) -> Result<()>
Encrypt the data using CFB mode, without padding. Overwrites the input.
pub fn new_session_key<R: Rng + CryptoRng>(self, rng: &mut R) -> Vec<u8>
[src]
Generate a new session key.
Trait Implementations
impl Clone for SymmetricKeyAlgorithm
[src]
fn clone(&self) -> SymmetricKeyAlgorithm
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for SymmetricKeyAlgorithm
[src]
impl Debug for SymmetricKeyAlgorithm
[src]
impl Default for SymmetricKeyAlgorithm
[src]
impl DefaultIsZeroes for SymmetricKeyAlgorithm
[src]
impl Eq for SymmetricKeyAlgorithm
[src]
impl FromPrimitive for SymmetricKeyAlgorithm
[src]
fn from_i64(n: i64) -> Option<Self>
[src]
fn from_u64(n: u64) -> Option<Self>
[src]
fn from_isize(n: isize) -> Option<Self>
[src]
fn from_i8(n: i8) -> Option<Self>
[src]
fn from_i16(n: i16) -> Option<Self>
[src]
fn from_i32(n: i32) -> Option<Self>
[src]
fn from_i128(n: i128) -> Option<Self>
[src]
fn from_usize(n: usize) -> Option<Self>
[src]
fn from_u8(n: u8) -> Option<Self>
[src]
fn from_u16(n: u16) -> Option<Self>
[src]
fn from_u32(n: u32) -> Option<Self>
[src]
fn from_u128(n: u128) -> Option<Self>
[src]
fn from_f32(n: f32) -> Option<Self>
[src]
fn from_f64(n: f64) -> Option<Self>
[src]
impl PartialEq<SymmetricKeyAlgorithm> for SymmetricKeyAlgorithm
[src]
fn eq(&self, other: &SymmetricKeyAlgorithm) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for SymmetricKeyAlgorithm
[src]
impl StructuralPartialEq for SymmetricKeyAlgorithm
[src]
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
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
[src]
T: InitializableFromZeroed + ?Sized,
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
[src]
T: Default,
unsafe fn initialize(place: *mut 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.
fn to_owned(&self) -> T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,