[−][src]Enum yaca::BlockCipherMode
Enumeration of YACA chaining modes for block ciphers
Variants
Used when algorithm doesn't support block ciphers modes.
- Initialization Vector is not used.
ECB block cipher mode.
- Initialization Vector is not used.
- By default the input data is padded using standard block
padding
PKCS7
. - Padding can be disabled using
CtxPad::set_property_padding()
andPadding::None
. The total length of data passed until*::finalize()
must be a multiple of block size in such case. - In case of
Encrypt
/Seal
Padding
can be set at the latest before the*::finalize()
call. In case ofDecrypt
/Open
it can be set at the latest before the*::update()
call.
CTR block cipher mode
- 128-bit
Initialization Vector
forAES
, 64-bit for other algorithms is mandatory.
CBC block cipher mode
- 128-bit
Initialization Vector
forAES
. - 64-bit for other algorithms is mandatory.
- By default the input data is padded using standard block
padding
PKCS7
. - Padding can be disabled using
CtxPad::set_property_padding
andPadding::None
. The total length of data passed until*::finalize()
must be a multiple of block size in such case. - In case of
Encrypt
/Seal
Padding
can be set at the latest before the*::finalize()
call. In case ofDecrypt
/Open
it can be set at the latest before the*::update()
call.
GCM block cipher mode
- This is a variable
Initialization Vector
length mode (recommended 96-bits). - Supported properties:
- GCM tag length (optional)
CtxXcmEnc::set_property_gcm_tag_len()
Supported tag lengths: 4, 8, 12, 13, 14, 15, 16 (16 bytes tag by default).
Set afterEncryptContext::finalize()
/SealContext::finalize()
and beforeCtxXcmEnc::get_property_gcm_tag()
inEncryption
/Seal
operation. InDecryption
/Open
operation tag length is not set. - GCM tag
CtxXcmEnc::get_property_gcm_tag()
CtxXcmDec::set_property_gcm_tag()
Get afterEncryptContext::finalize()
/SealContext::finalize()
inEncryption
/Seal
operation.
Set afterDecryptContext::update()
/OpenContext::update()
and beforeDecryptContext::finalize()
/OpenContext::finalize()
inDecryption
/Open
operation. - AAD - additional authentication data (optional)
CtxXcmEnc::set_property_gcm_aad()
CtxXcmDec::set_property_gcm_aad()
AAD length can have any positive value.
Set afterEncryptContext::initialize()
/SealContext::initialize()
and beforeEncryptContext::update()
/SealContext::update()
inEncryption
/Seal
operation.
Set afterDecryptContext::initialize()
/OpenContext::initialize()
and beforeDecryptContext::update()
/OpenContext::update()
inDecryption
/Open
operation.
- GCM tag length (optional)
Default CFB block cipher mode
- 128-bit
Initialization Vector
forAES
, 64-bit for other algorithms is mandatory.
1 bit CFB block cipher mode
- 128-bit
Initialization Vector
forAES
, 64-bit for other algorithms is mandatory.
8 bits CFB block cipher mode
- 128-bit
Initialization Vector
forAES
, 64-bit for other algorithms is mandatory.
OFB block cipher mode
- 128-bit
Initialization Vector
forAES
, 64-bit for other algorithms is mandatory.
CBC-MAC Mode (AES)
-
This is a variable
Initialization Vector
length mode. -
Supported
Initialization Vector
lengths: 56-104 bits in steps of 8 bits (recommended 56-bits). -
Supported properties:
-
CCM tag length (optional)
CtxXcmEnc::set_property_ccm_tag_len()
Supported tag lengths: 4-16 bytes in steps of 2 bytes (12 bytes tag by default).
Set afterEncryptContext::initialize()
/SealContext::initialize()
and beforeEncryptContext::update()
/SealContext::update()
inEncryption
/Seal
operation.
InDecryption
/Open
operation tag length is not set. -
CCM tag
CtxXcmEnc::get_property_ccm_tag()
CtxXcmDec::set_property_ccm_tag()
Get afterEncryptContext::finalize()
/SealContext::finalize()
inEncryption
/Seal
operation.
Set afterDecryptContext::initialize()
/OpenContext::initialize()
and beforeDecryptContext::update()
/OpenContext::update()
in decryption / open operation. -
AAD - additional authentication data (optional)
CtxXcmEnc::set_property_ccm_aad()
CtxXcmDec::set_property_ccm_aad()
AAD length can have any positive value.The total plaintext length must be passed to
CtxXcmEnc::set_property_ccm_aad()
if AAD is used.
Set afterEncryptContext::initialize()
/SealContext::initialize()
and beforeEncryptContext::update()
/SealContext::update()
inEncryption
/Seal
operation.The total ciphertext length must be passed to
CtxXcmDec::set_property_ccm_aad()
if AAD is used.
Set afterDecryptContext::initialize()
/OpenContext::initialize()
and beforeDecryptContext::update()
/OpenContext::update()
inDecryption
/Open
operation.
-
-
You can only call
EncryptContext::update()
/SealContext::update()
once for the plaintext.
You can only callDecryptContext::update()
/OpenContext::update()
once for the ciphertext.
Used with AES
or 3DES_3TDEA
to perform a key wrapping
(key material symmetric encryption)
- Only a single
EncryptContext::update()
/DecryptContext::update()
is allowed. - Usage in
SealContext::initialize()
/OpenContext::initialize()
is forbidden. - Key used to do the wrapping with
EncryptAlgorithm::Aes
can be a128
,192
or a256
bit key.
64
bitInitialization Vector
is used.
Wrapped key can be a128
,192
, or a256
bit key.
EncryptAlgorithm::Aes
allows wrapping multiple keys together. - Key used to do the wrapping with
EncryptAlgorithm::UnsafeTripleDes2Tdea
can be a192
bitDES
key only. Initialization Vector is not used.
Wrapped key can be a128
bitDES
key (two-key), or a192
bitDES
key (three-key).
EncryptAlgorithm::UnsafeTripleDes2Tdea
allows wrapping only one key.
Trait Implementations
impl Debug for BlockCipherMode
[src]
impl PartialEq<BlockCipherMode> for BlockCipherMode
[src]
pub fn eq(&self, other: &BlockCipherMode) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for BlockCipherMode
[src]
Auto Trait Implementations
impl RefUnwindSafe for BlockCipherMode
impl Send for BlockCipherMode
impl Sync for BlockCipherMode
impl Unpin for BlockCipherMode
impl UnwindSafe for BlockCipherMode
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,