Crypto++
5.6.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
6 #ifndef CRYPTOPP_SECKEY_H
7 #define CRYPTOPP_SECKEY_H
11 #if CRYPTOPP_MSC_VERSION
12 # pragma warning(push)
13 # pragma warning(disable: 4189)
33 template <
unsigned int N>
46 template <
unsigned int R>
59 template <
unsigned int D,
unsigned int N=1,
unsigned int M=INT_MAX>
77 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
78 return CRYPTOPP_UNUSED(keylength),
static_cast<unsigned int>(
DEFAULT_ROUNDS);
80 CRYPTOPP_UNUSED(keylength);
91 inline void ThrowIfInvalidRounds(
int rounds,
const Algorithm *alg)
100 if (rounds < MIN_ROUNDS || rounds >
MAX_ROUNDS)
114 ThrowIfInvalidRounds(rounds, alg);
115 return (
unsigned int)rounds;
127 template <
unsigned int N,
unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE,
unsigned int IV_L = 0>
158 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
159 return CRYPTOPP_UNUSED(keylength),
static_cast<size_t>(
KEYLENGTH);
161 CRYPTOPP_UNUSED(keylength);
176 template <
unsigned int D,
unsigned int N,
unsigned int M,
unsigned int Q = 1,
unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE,
unsigned int IV_L = 0>
236 template <
class T,
unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE,
unsigned int IV_L = 0>
265 {
return T::StaticGetValidKeyLength(keylength);}
277 template <
class BASE,
class INFO = BASE>
284 {
return INFO::MIN_KEYLENGTH;}
289 {
return (
size_t)INFO::MAX_KEYLENGTH;}
294 {
return INFO::DEFAULT_KEYLENGTH;}
304 size_t GetValidKeyLength(
size_t keylength)
const {
return INFO::StaticGetValidKeyLength(keylength);}
315 {
return INFO::IV_LENGTH;}
325 template <
class INFO,
class BASE = BlockCipher>
331 unsigned int BlockSize()
const {
return this->BLOCKSIZE;}
338 template <CipherDir DIR,
class BASE>
351 {this->SetKey(key, this->DEFAULT_KEYLENGTH);}
359 {this->SetKey(key, length);}
368 {this->SetKeyWithRounds(key, length, rounds);}
384 template <
class BASE,
class INFO = BASE>
393 template <
class BASE>
405 {this->SetKey(key, this->DEFAULT_KEYLENGTH);}
412 {this->SetKey(key, length);}
462 #if CRYPTOPP_MSC_VERSION
463 # pragma warning(pop)
BlockCipher Encryption
implements the BlockCipher interface
AuthenticatedSymmetricCipher Encryption
implements the AuthenticatedSymmetricCipher interface
virtual std::string AlgorithmName() const
Provides the name of this algorithm.
size_t MinKeyLength() const
The minimum key length used by the algorithm.
Provides a base implementation of SimpleKeyingInterface.
size_t DefaultKeyLength() const
The default key length used by the algorithm.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher.
MessageAuthenticationCodeFinal()
Construct a default MessageAuthenticationCodeFinal.
static const int KEYLENGTH_MULTIPLE
The key length multiple used by the algorithm provided as a constant.
@ DECRYPTION
the cipher is performing decryption
static const int DEFAULT_KEYLENGTH
The default key length used by the algorithm provided as a constant.
int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
Interface for all crypto algorithms.
SimpleKeyingInterface::IV_Requirement IVRequirement() const
The default IV requirements for the algorithm.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode.
Provides Encryption and Decryption typedefs used by derived classes to implement an authenticated enc...
BlockCipherFinal(const byte *key, size_t length, unsigned int rounds)
Construct a BlockCipherFinal.
BlockCipher Decryption
implements the BlockCipher interface
@ ENCRYPTION
the cipher is performing encryption
static const int KEYLENGTH
The default key length used by the algorithm provided as a constant.
static const int DEFAULT_KEYLENGTH
The default key length used by the algorithm provided as a constant.
#define CRYPTOPP_COMPILE_ASSERT(expr)
Compile time assertion.
static const int IV_REQUIREMENT
The default IV requirements for the algorithm provided as a constant.
static size_t StaticGetValidKeyLength(size_t keylength)
The default key length for the algorithm provided by a static function.
static const int MIN_ROUNDS
The minimum number of rounds for the algorithm provided as a constant.
static const int MIN_KEYLENGTH
The minimum key length used by the algorithm provided as a constant.
Inherited by algorithms with fixed block size.
static const int DEFAULT_ROUNDS
The default number of rounds for the algorithm provided as a constant.
MessageAuthenticationCodeFinal(const byte *key)
Construct a BlockCipherFinal.
CipherDir ReverseCipherDir(CipherDir dir)
Inverts the cipher's direction.
size_t MaxKeyLength() const
The maximum key length used by the algorithm.
unsigned int BlockSize() const
Provides the block size of the algorithm.
CipherDir
Specifies a direction for a cipher to operate.
Classes providing basic library services.
IV_Requirement
Secure IVs requirements as enumerated values.
static const int ROUNDS
The number of rounds for the algorithm provided as a constant.
static const int IV_LENGTH
The default initialization vector length for the algorithm provided as a constant.
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Inherited by keyed algorithms with fixed key length.
Utility functions for the Crypto++ library.
static unsigned int StaticGetDefaultRounds(size_t keylength)
The default number of rounds for the algorithm based on key length provided by a static function.
static const int IV_LENGTH
The default initialization vector length for the algorithm provided as a constant.
Provides key lengths based on another class's key length.
Exception thrown when an invalid number of rounds is encountered.
BlockCipherFinal(const byte *key, size_t length)
Construct a BlockCipherFinal.
BlockCipherFinal(const byte *key)
Construct a BlockCipherFinal.
static const int MIN_KEYLENGTH
The minimum key length used by the algorithm provided as a constant.
static const int MAX_ROUNDS
The maximum number of rounds for the algorithm provided as a constant.
static const int BLOCKSIZE
The block size of the algorithm provided as a constant.
static const int MAX_KEYLENGTH
The maximum key length used by the algorithm provided as a constant.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Provides class member functions to key a block cipher.
size_t GetValidKeyLength(size_t keylength) const
Provides a valid key length for the algorithm.
Provides a base implementation of Algorithm and SimpleKeyingInterface for message authentication code...
static size_t StaticGetValidKeyLength(size_t keylength)
Provides a valid key length for the algorithm provided by a static function.
static const int IV_REQUIREMENT
The default IV requirements for the algorithm provided as a constant.
unsigned int IVSize() const
The default initialization vector length for the algorithm.
static const int MAX_KEYLENGTH
The maximum key length used by the algorithm provided as a constant.
Base class for identifying alogorithm.
Crypto++ library namespace.
static const int DEFAULT_KEYLENGTH
The default key length used by the algorithm provided as a constant.
Library configuration file.
bool IsForwardTransformation() const
Provides the direction of the cipher.
Interface for one direction (encryption or decryption) of a block cipher.
BlockCipherFinal()
Construct a default BlockCipherFinal.
static size_t StaticGetValidKeyLength(size_t keylength)
Provides a valid key length for the algorithm provided by a static function.
SymmetricCipher Encryption
implements the SymmetricCipher interface
static const int IV_LENGTH
The default IV length used by the algorithm provided as a constant.
static const int MAX_KEYLENGTH
The maximum key length used by the algorithm provided as a constant.
Provides class member functions to key a message authentication code.
Inherited by algorithms with variable number of rounds.
Interface for retrieving values given their names.
Abstract base classes that provide a uniform interface to this library.
Inherited by algorithms with fixed number of rounds.
AuthenticatedSymmetricCipher Decryption
implements the AuthenticatedSymmetricCipher interface
static const int IV_REQUIREMENT
The default IV requirements for the algorithm provided as a constant.
MessageAuthenticationCodeFinal(const byte *key, size_t length)
Construct a BlockCipherFinal.
Base class for identifying alogorithm.
SymmetricCipher Decryption
implements the SymmetricCipher interface
static const int MIN_KEYLENGTH
The minimum key length used by the algorithm provided as a constant.
Interface for one direction (encryption or decryption) of a stream cipher or block cipher mode with a...
Inherited by keyed algorithms with variable key length.