Fabcoin Core
0.16.2
P2P Digital Currency
|
Interface for algorithms that take byte strings as keys. More...
#include <cryptlib.h>
Public Types | |
enum | IV_Requirement { UNIQUE_IV = 0, RANDOM_IV, UNPREDICTABLE_RANDOM_IV, INTERNALLY_GENERATED_IV, NOT_RESYNCHRONIZABLE } |
Secure IVs requirements as enumerated values. More... | |
Public Member Functions | |
virtual | ~SimpleKeyingInterface () |
virtual size_t | MinKeyLength () const =0 |
Returns smallest valid key length. More... | |
virtual size_t | MaxKeyLength () const =0 |
Returns largest valid key length. More... | |
virtual size_t | DefaultKeyLength () const =0 |
Returns default key length. More... | |
virtual size_t | GetValidKeyLength (size_t keylength) const =0 |
Returns a valid key length for the algorithm. More... | |
virtual bool | IsValidKeyLength (size_t keylength) const |
Returns whether keylength is a valid key length. More... | |
virtual void | SetKey (const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs) |
Sets or reset the key of this object. More... | |
void | SetKeyWithRounds (const byte *key, size_t length, int rounds) |
Sets or reset the key of this object. More... | |
void | SetKeyWithIV (const byte *key, size_t length, const byte *iv, size_t ivLength) |
Sets or reset the key of this object. More... | |
void | SetKeyWithIV (const byte *key, size_t length, const byte *iv) |
Sets or reset the key of this object. More... | |
virtual IV_Requirement | IVRequirement () const =0 |
Minimal requirement for secure IVs. More... | |
bool | IsResynchronizable () const |
Determines if the object can be resynchronized. More... | |
bool | CanUseRandomIVs () const |
Determines if the object can use random IVs. More... | |
bool | CanUsePredictableIVs () const |
Determines if the object can use random but possibly predictable IVs. More... | |
bool | CanUseStructuredIVs () const |
Determines if the object can use structured IVs. More... | |
virtual unsigned int | IVSize () const |
Returns length of the IV accepted by this object. More... | |
unsigned int | DefaultIVLength () const |
Provides the default size of an IV. More... | |
virtual unsigned int | MinIVLength () const |
Provides the minimum size of an IV. More... | |
virtual unsigned int | MaxIVLength () const |
Provides the maximum size of an IV. More... | |
virtual void | Resynchronize (const byte *iv, int ivLength=-1) |
Resynchronize with an IV. More... | |
virtual void | GetNextIV (RandomNumberGenerator &rng, byte *iv) |
Retrieves a secure IV for the next message. More... | |
Protected Member Functions | |
virtual const Algorithm & | GetAlgorithm () const =0 |
Returns the base class Algorithm. More... | |
virtual void | UncheckedSetKey (const byte *key, unsigned int length, const NameValuePairs ¶ms)=0 |
Sets the key for this object without performing parameter validation. More... | |
void | ThrowIfInvalidKeyLength (size_t length) |
Validates the key length. More... | |
void | ThrowIfResynchronizable () |
Validates the object. More... | |
void | ThrowIfInvalidIV (const byte *iv) |
Validates the IV. More... | |
size_t | ThrowIfInvalidIVLength (int length) |
Validates the IV length. More... | |
const byte * | GetIVAndThrowIfInvalid (const NameValuePairs ¶ms, size_t &size) |
Retrieves and validates the IV. More... | |
void | AssertValidKeyLength (size_t length) const |
Validates the key length. More... | |
Interface for algorithms that take byte strings as keys.
Definition at line 524 of file cryptlib.h.
Secure IVs requirements as enumerated values.
Provides secure IV requirements as a monotonically increasing enumerated values. Requirements can be compared using less than (<) and greater than (>). For example, UNIQUE_IV < RANDOM_IV
and UNPREDICTABLE_RANDOM_IV > RANDOM_IV
.
Definition at line 598 of file cryptlib.h.
|
inlinevirtual |
Definition at line 527 of file cryptlib.h.
|
inlineprotected |
Validates the key length.
length | the size of the keying material, in bytes |
Definition at line 725 of file cryptlib.h.
|
inline |
Determines if the object can use random but possibly predictable IVs.
Definition at line 628 of file cryptlib.h.
|
inline |
Determines if the object can use random IVs.
Definition at line 623 of file cryptlib.h.
|
inline |
Determines if the object can use structured IVs.
CanUseStructuredIVs() indicates whether the object can use structured IVs; for example a counter (in addition to ones returned by GetNextIV).
Definition at line 634 of file cryptlib.h.
|
inline |
Provides the default size of an IV.
Definition at line 645 of file cryptlib.h.
|
pure virtual |
Returns default key length.
Implemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
|
protectedpure virtual |
Returns the base class Algorithm.
Implemented in AuthenticatedSymmetricCipher, MessageAuthenticationCode, SymmetricCipher, and BlockCipher.
|
protected |
Retrieves and validates the IV.
params | NameValuePairs with the IV supplied as a ConstByteArrayParameter |
size | the length of the IV, in bytes |
InvalidArgument | if the number of rounds are invalid |
Definition at line 143 of file cryptlib.cpp.
|
virtual |
Retrieves a secure IV for the next message.
rng | a RandomNumberGenerator to produce keying material |
iv | a block of bytes to receive the IV |
The IV must be at least IVSize() in length.
This method should be called after you finish encrypting one message and are ready to start the next one. After calling it, you must call SetKey() or Resynchronize(). before using this object again.
Internally, the base class implementation calls RandomNumberGenerator's GenerateBlock()
Reimplemented in Poly1305_Base< T >, and VMAC_Base.
Definition at line 173 of file cryptlib.cpp.
|
pure virtual |
Returns a valid key length for the algorithm.
keylength | the size of the key, in bytes |
keylength is provided in bytes, not bits. If keylength is less than MIN_KEYLENGTH, then the function returns MIN_KEYLENGTH. If keylength is greater than MAX_KEYLENGTH, then the function returns MAX_KEYLENGTH. if If keylength is a multiple of KEYLENGTH_MULTIPLE, then keylength is returned. Otherwise, the function returns a lower multiple of KEYLENGTH_MULTIPLE.
Implemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
|
inline |
Determines if the object can be resynchronized.
CanUseStructuredIVs()==true
, an IV of all 0's will be assumed. Definition at line 619 of file cryptlib.h.
|
inlinevirtual |
Returns whether keylength is a valid key length.
keylength | the requested keylength |
Internally the function calls GetValidKeyLength()
Reimplemented in CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
Definition at line 553 of file cryptlib.h.
|
pure virtual |
Minimal requirement for secure IVs.
Implemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, CBC_ModeBase, ECB_OneWay, CTR_ModePolicy, OFB_ModePolicy, CFB_ModePolicy, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
|
inlinevirtual |
Returns length of the IV accepted by this object.
NotImplemented() | if the object does not support resynchronization |
The default implementation throws NotImplemented
Reimplemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, EAX_Base, and VMAC_Base.
Definition at line 640 of file cryptlib.h.
|
inlinevirtual |
Provides the maximum size of an IV.
NotImplemented() | if the object does not support resynchronization |
Reimplemented in GCM_Base, CCM_Base, and EAX_Base.
Definition at line 655 of file cryptlib.h.
|
pure virtual |
Returns largest valid key length.
Implemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
|
inlinevirtual |
Provides the minimum size of an IV.
NotImplemented() | if the object does not support resynchronization |
Reimplemented in GCM_Base, CCM_Base, EAX_Base, and VMAC_Base.
Definition at line 650 of file cryptlib.h.
|
pure virtual |
Returns smallest valid key length.
Implemented in SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SEED_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Blowfish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SKIPJACK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, TEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MARS_Info > >, SimpleKeyingInterfaceImpl< Poly1305_Base< T >, Poly1305_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHACAL2_Info > >, SimpleKeyingInterfaceImpl< HMAC_Base, HMAC< H > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE2_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, GOST_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Rijndael_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, MDC_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< MessageAuthenticationCode, VariableKeyLength< 32, 0, INT_MAX > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC5_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, SHARK_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_XEX3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST128_Info > >, SimpleKeyingInterfaceImpl< DMAC_Base< T >, DMAC_Base< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC2_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, IDEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, ThreeWay_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Serpent_Info > >, SimpleKeyingInterfaceImpl< VMAC_Base, SameKeyLengthAs< T_BlockCipher, SimpleKeyingInterface::UNIQUE_IV, T_BlockCipher::BLOCKSIZE > >, SimpleKeyingInterfaceImpl< BlockCipher, BTEA_Info >, SimpleKeyingInterfaceImpl< CBC_MAC_Base, CBC_MAC< T > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, DES_EDE3_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, XTEA_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Square_Info > >, SimpleKeyingInterfaceImpl< CMAC_Base, CMAC< T_BlockCipher > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, LR_Info< T > > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, RC6_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Twofish_Info > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, CAST256_Info > >, SimpleKeyingInterfaceImpl< MessageAuthenticationCode, BLAKE2_Info< T_64bit > >, SimpleKeyingInterfaceImpl< TwoBases< BlockCipher, Camellia_Info > >, SipHash_Base< C, D, T_128bit >, CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.
|
inlinevirtual |
Resynchronize with an IV.
iv | the initialization vector |
ivLength | the size of the initialization vector, in bytes |
Resynchronize() resynchronizes with an IV provided by the caller. ivLength=-1
means use IVSize().
NotImplemented() | if the object does not support resynchronization |
Reimplemented in AdditiveCipherTemplate< AbstractPolicyHolder< AdditiveCipherAbstractPolicy, CTR_ModePolicy > >, BlockOrientedCipherModeBase, Poly1305_Base< T >, AuthenticatedSymmetricCipherBase, and VMAC_Base.
Definition at line 662 of file cryptlib.h.
|
virtual |
Sets or reset the key of this object.
key | the key to use when keying the object |
length | the size of the key, in bytes |
params | additional initialization parameters that cannot be passed directly through the constructor |
Reimplemented in ECB_OneWay, and AuthenticatedSymmetricCipherBase.
Definition at line 97 of file cryptlib.cpp.
void SimpleKeyingInterface::SetKeyWithIV | ( | const byte * | key, |
size_t | length, | ||
const byte * | iv, | ||
size_t | ivLength | ||
) |
Sets or reset the key of this object.
key | the key to use when keying the object |
length | the size of the key, in bytes |
iv | the intiialization vector to use when keying the object |
ivLength | the size of the iv, in bytes |
SetKeyWithIV() calls SetKey() with a NameValuePairs that only specifies IV. The IV is a byte buffer with size ivLength. ivLength is an integer parameter, and -1
means use IVSize().
Definition at line 108 of file cryptlib.cpp.
|
inline |
Sets or reset the key of this object.
key | the key to use when keying the object |
length | the size of the key, in bytes |
iv | the intiialization vector to use when keying the object |
SetKeyWithIV() calls SetKey() with a NameValuePairs() object that only specifies iv. iv is a byte buffer, and it must have a size IVSize().
Definition at line 590 of file cryptlib.h.
void SimpleKeyingInterface::SetKeyWithRounds | ( | const byte * | key, |
size_t | length, | ||
int | rounds | ||
) |
Sets or reset the key of this object.
key | the key to use when keying the object |
length | the size of the key, in bytes |
rounds | the number of rounds to apply the transformation function, if applicable |
SetKeyWithRounds() calls SetKey() with a NameValuePairs object that only specifies rounds. rounds is an integer parameter, and -1
means use the default number of rounds.
Definition at line 103 of file cryptlib.cpp.
|
protected |
Validates the IV.
iv | the IV with a length of IVSize, in bytes |
InvalidArgument | on failure |
Internally, the default implementation checks the iv. If iv is not NULL, then the function succeeds. If iv is NULL, then IVRequirement is checked against UNPREDICTABLE_RANDOM_IV. If IVRequirement is UNPREDICTABLE_RANDOM_IV, then then the function succeeds. Otherwise, an exception is thrown.
Definition at line 125 of file cryptlib.cpp.
|
protected |
Validates the IV length.
length | the size of an IV, in bytes |
InvalidArgument | if the number of rounds are invalid |
Definition at line 131 of file cryptlib.cpp.
|
protected |
Validates the key length.
length | the size of the keying material, in bytes |
InvalidKeyLength | if the key length is invalid |
Definition at line 113 of file cryptlib.cpp.
|
protected |
Validates the object.
InvalidArgument | if the IV is present |
Internally, the default implementation calls IsResynchronizable() and throws InvalidArgument if the function returns true.
Definition at line 119 of file cryptlib.cpp.
|
protectedpure virtual |
Sets the key for this object without performing parameter validation.
key | a byte buffer used to key the cipher |
length | the length of the byte buffer |
params | additional parameters passed as NameValuePairs |
key must be at least DEFAULT_KEYLENGTH in length.
Implemented in AdditiveCipherTemplate< AbstractPolicyHolder< AdditiveCipherAbstractPolicy, CTR_ModePolicy > >, CBC_CTS_Encryption, BlockOrientedCipherModeBase, DES_XEX3::Base, BTEA::Base, DES_EDE3::Base, CAST256::Base, SipHash_Base< C, D, T_128bit >, DES_EDE2::Base, XTEA::Base, Poly1305_Base< T >, HermeticHashFunctionMAC< T_Hash, T_Info >, HermeticHashFunctionMAC< PanamaHash< B > >, DES::Base, Weak1::ARC4_Base, IDEA::Base, CAST128::Base, MDC< T >::Enc, Rijndael::Base, Blowfish::Base, RC2::Base, VMAC_Base, ThreeWay::Base, RC5::Base, SEED::Base, SHARK::Base, TEA::Base, GOST::Base, LR< T >::Base, SKIPJACK::Base, Camellia::Base, RC6::Base, MARS::Base, Serpent::Base, SHACAL2::Base, Square::Base, Twofish::Base, DMAC_Base< T >, SAFER::Base, TTMAC_Base, CMAC_Base, HMAC_Base, and CBC_MAC_Base.