Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | Protected Member Functions | List of all members
SimpleKeyingInterface Class Referenceabstract

Interface for algorithms that take byte strings as keys. More...

#include <cryptlib.h>

Inheritance diagram for SimpleKeyingInterface:
[legend]

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 &params=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 AlgorithmGetAlgorithm () const =0
 Returns the base class Algorithm. More...
 
virtual void UncheckedSetKey (const byte *key, unsigned int length, const NameValuePairs &params)=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 byteGetIVAndThrowIfInvalid (const NameValuePairs &params, size_t &size)
 Retrieves and validates the IV. More...
 
void AssertValidKeyLength (size_t length) const
 Validates the key length. More...
 

Detailed Description

Interface for algorithms that take byte strings as keys.

See also
FixedKeyLength(), VariableKeyLength(), SameKeyLengthAs(), SimpleKeyingInterfaceImpl()

Definition at line 524 of file cryptlib.h.

Member Enumeration Documentation

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.

See also
IsResynchronizable(), CanUseRandomIVs(), CanUsePredictableIVs(), CanUseStructuredIVs()
Enumerator
UNIQUE_IV 

The IV must be unique.

RANDOM_IV 

The IV must be random and possibly predictable.

UNPREDICTABLE_RANDOM_IV 

The IV must be random and unpredictable.

INTERNALLY_GENERATED_IV 

The IV is set by the object.

NOT_RESYNCHRONIZABLE 

The object does not use an IV.

Definition at line 598 of file cryptlib.h.

Constructor & Destructor Documentation

virtual SimpleKeyingInterface::~SimpleKeyingInterface ( )
inlinevirtual

Definition at line 527 of file cryptlib.h.

Member Function Documentation

void SimpleKeyingInterface::AssertValidKeyLength ( size_t  length) const
inlineprotected

Validates the key length.

Parameters
lengththe size of the keying material, in bytes

Definition at line 725 of file cryptlib.h.

Here is the caller graph for this function:

bool SimpleKeyingInterface::CanUsePredictableIVs ( ) const
inline

Determines if the object can use random but possibly predictable IVs.

Returns
true if the object can use random but possibly predictable IVs (in addition to ones returned by GetNextIV), false otherwise

Definition at line 628 of file cryptlib.h.

bool SimpleKeyingInterface::CanUseRandomIVs ( ) const
inline

Determines if the object can use random IVs.

Returns
true if the object can use random IVs (in addition to ones returned by GetNextIV), false otherwise

Definition at line 623 of file cryptlib.h.

bool SimpleKeyingInterface::CanUseStructuredIVs ( ) const
inline

Determines if the object can use structured IVs.

Returns
true if the object can use structured IVs, false otherwise

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.

unsigned int SimpleKeyingInterface::DefaultIVLength ( ) const
inline

Provides the default size of an IV.

Returns
default length of IVs accepted by this object, in bytes

Definition at line 645 of file cryptlib.h.

virtual size_t SimpleKeyingInterface::DefaultKeyLength ( ) const
pure virtual

Returns default key length.

Returns
the default (recommended) key length, in bytes

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.

virtual const Algorithm& SimpleKeyingInterface::GetAlgorithm ( ) const
protectedpure virtual

Returns the base class Algorithm.

Returns
the base class Algorithm

Implemented in AuthenticatedSymmetricCipher, MessageAuthenticationCode, SymmetricCipher, and BlockCipher.

const byte * SimpleKeyingInterface::GetIVAndThrowIfInvalid ( const NameValuePairs params,
size_t &  size 
)
protected

Retrieves and validates the IV.

Parameters
paramsNameValuePairs with the IV supplied as a ConstByteArrayParameter
sizethe length of the IV, in bytes
Returns
a pointer to the first byte of the IV
Exceptions
InvalidArgumentif the number of rounds are invalid

Definition at line 143 of file cryptlib.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void SimpleKeyingInterface::GetNextIV ( RandomNumberGenerator rng,
byte iv 
)
virtual

Retrieves a secure IV for the next message.

Parameters
rnga RandomNumberGenerator to produce keying material
iva 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()

Note
This method is not implemented on decryption objects.

Reimplemented in Poly1305_Base< T >, and VMAC_Base.

Definition at line 173 of file cryptlib.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual size_t SimpleKeyingInterface::GetValidKeyLength ( size_t  keylength) const
pure virtual

Returns a valid key length for the algorithm.

Parameters
keylengththe size of the key, in bytes
Returns
the valid key length, 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.

bool SimpleKeyingInterface::IsResynchronizable ( ) const
inline

Determines if the object can be resynchronized.

Returns
true if the object can be resynchronized (i.e. supports initialization vectors), false otherwise
Note
If this function returns true, and no IV is passed to SetKey() and CanUseStructuredIVs()==true, an IV of all 0's will be assumed.

Definition at line 619 of file cryptlib.h.

Here is the caller graph for this function:

virtual bool SimpleKeyingInterface::IsValidKeyLength ( size_t  keylength) const
inlinevirtual

Returns whether keylength is a valid key length.

Parameters
keylengththe requested keylength
Returns
true if keylength is valid, false otherwise

Internally the function calls GetValidKeyLength()

Reimplemented in CipherModeBase, GCM_Base, CCM_Base, and EAX_Base.

Definition at line 553 of file cryptlib.h.

virtual IV_Requirement SimpleKeyingInterface::IVRequirement ( ) const
pure virtual

Minimal requirement for secure IVs.

Returns
the secure IV requirement of the algorithm

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.

Here is the caller graph for this function:

virtual unsigned int SimpleKeyingInterface::IVSize ( ) const
inlinevirtual

Returns length of the IV accepted by this object.

Returns
the size of an IV, in bytes
Exceptions
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.

Here is the caller graph for this function:

virtual unsigned int SimpleKeyingInterface::MaxIVLength ( ) const
inlinevirtual

Provides the maximum size of an IV.

Returns
maximal length of IVs accepted by this object, in bytes
Exceptions
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.

virtual size_t SimpleKeyingInterface::MaxKeyLength ( ) const
pure virtual

Returns largest valid key length.

Returns
the maximum key length, in bytes

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.

virtual unsigned int SimpleKeyingInterface::MinIVLength ( ) const
inlinevirtual

Provides the minimum size of an IV.

Returns
minimal length of IVs accepted by this object, in bytes
Exceptions
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.

virtual size_t SimpleKeyingInterface::MinKeyLength ( ) const
pure virtual

Returns smallest valid key length.

Returns
the minimum key length, in bytes

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.

virtual void SimpleKeyingInterface::Resynchronize ( const byte iv,
int  ivLength = -1 
)
inlinevirtual

Resynchronize with an IV.

Parameters
ivthe initialization vector
ivLengththe size of the initialization vector, in bytes

Resynchronize() resynchronizes with an IV provided by the caller. ivLength=-1 means use IVSize().

Exceptions
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.

Here is the caller graph for this function:

void SimpleKeyingInterface::SetKey ( const byte key,
size_t  length,
const NameValuePairs params = g_nullNameValuePairs 
)
virtual

Sets or reset the key of this object.

Parameters
keythe key to use when keying the object
lengththe size of the key, in bytes
paramsadditional initialization parameters that cannot be passed directly through the constructor

Reimplemented in ECB_OneWay, and AuthenticatedSymmetricCipherBase.

Definition at line 97 of file cryptlib.cpp.

Here is the caller graph for this function:

void SimpleKeyingInterface::SetKeyWithIV ( const byte key,
size_t  length,
const byte iv,
size_t  ivLength 
)

Sets or reset the key of this object.

Parameters
keythe key to use when keying the object
lengththe size of the key, in bytes
ivthe intiialization vector to use when keying the object
ivLengththe 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.

Here is the call graph for this function:

void SimpleKeyingInterface::SetKeyWithIV ( const byte key,
size_t  length,
const byte iv 
)
inline

Sets or reset the key of this object.

Parameters
keythe key to use when keying the object
lengththe size of the key, in bytes
ivthe 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.

Parameters
keythe key to use when keying the object
lengththe size of the key, in bytes
roundsthe 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.

Here is the call graph for this function:

void SimpleKeyingInterface::ThrowIfInvalidIV ( const byte iv)
protected

Validates the IV.

Parameters
ivthe IV with a length of IVSize, in bytes
Exceptions
InvalidArgumenton 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.

Here is the caller graph for this function:

size_t SimpleKeyingInterface::ThrowIfInvalidIVLength ( int  length)
protected

Validates the IV length.

Parameters
lengththe size of an IV, in bytes
Exceptions
InvalidArgumentif the number of rounds are invalid

Definition at line 131 of file cryptlib.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void SimpleKeyingInterface::ThrowIfInvalidKeyLength ( size_t  length)
protected

Validates the key length.

Parameters
lengththe size of the keying material, in bytes
Exceptions
InvalidKeyLengthif the key length is invalid

Definition at line 113 of file cryptlib.cpp.

void SimpleKeyingInterface::ThrowIfResynchronizable ( )
protected

Validates the object.

Exceptions
InvalidArgumentif the IV is present

Internally, the default implementation calls IsResynchronizable() and throws InvalidArgument if the function returns true.

Note
called when no IV is passed

Definition at line 119 of file cryptlib.cpp.

Here is the caller graph for this function:

virtual void SimpleKeyingInterface::UncheckedSetKey ( const byte key,
unsigned int  length,
const NameValuePairs params 
)
protectedpure virtual

Sets the key for this object without performing parameter validation.

Parameters
keya byte buffer used to key the cipher
lengththe length of the byte buffer
paramsadditional 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.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: