83 #ifndef CRYPTOPP_CRYPTLIB_H 84 #define CRYPTOPP_CRYPTLIB_H 90 #if CRYPTOPP_MSC_VERSION 91 # pragma warning(push) 92 # pragma warning(disable: 4127 4189 4702) 115 template <
typename ENUM_TYPE,
int VALUE>
118 static ENUM_TYPE
ToEnum() {
return (ENUM_TYPE)VALUE;}
168 const char *
what()
const throw() {
return (m_what.c_str());}
170 const std::string &
GetWhat()
const {
return m_what;}
172 void SetWhat(
const std::string &s) {m_what = s;}
223 OS_Error(
ErrorType errorType,
const std::string &s,
const std::string& operation,
int errorCode)
224 :
Exception(errorType, s), m_operation(operation), m_errorCode(errorCode) {}
295 :
InvalidArgument(
"NameValuePairs: type mismatch for '" + name +
"', stored '" + stored.name() +
"', trying to retrieve '" + retrieving.name() +
"'")
296 , m_stored(stored), m_retrieving(retrieving) {}
317 return GetValue((std::string(
"ThisObject:")+
typeid(
T).
name()).c_str(),
object);
326 return GetValue((std::string(
"ThisPointer:")+
typeid(
T).
name()).c_str(), ptr);
339 return GetVoidValue(name,
typeid(
T), &value);
353 bool result = GetValue(name, value);
355 if (result) {
return value;}
363 {std::string result; GetValue(
"ValueNames", result);
return result;}
374 {
return GetValue(name, value);}
383 {
return GetValueWithDefault(name, defaultValue);}
410 if (!GetValue(name, value))
411 throw InvalidArgument(std::string(className) +
": missing required parameter '" + name +
"'");
425 if (!GetIntValue(name, value))
426 throw InvalidArgument(std::string(className) +
": missing required parameter '" + name +
"'");
439 CRYPTOPP_DLL virtual bool GetVoidValue(
const char *
name,
const std::type_info &valueType,
void *pValue)
const =0;
442 #if CRYPTOPP_DOXYGEN_PROCESSING 510 Algorithm(
bool checkSelfTestStatus =
true);
531 virtual size_t MinKeyLength()
const =0;
534 virtual size_t MaxKeyLength()
const =0;
537 virtual size_t DefaultKeyLength()
const =0;
547 virtual size_t GetValidKeyLength(
size_t keylength)
const =0;
554 {
return keylength == GetValidKeyLength(keylength);}
571 void SetKeyWithRounds(
const byte *key,
size_t length,
int rounds);
581 void SetKeyWithIV(
const byte *key,
size_t length,
const byte *iv,
size_t ivLength);
591 {SetKeyWithIV(key, length, iv, IVSize());}
641 {
throw NotImplemented(GetAlgorithm().AlgorithmName() +
": this object doesn't support resynchronization");}
664 throw NotImplemented(GetAlgorithm().AlgorithmName() +
": this object doesn't support resynchronization");
681 virtual const Algorithm & GetAlgorithm()
const =0;
688 virtual void UncheckedSetKey(
const byte *key,
unsigned int length,
const NameValuePairs ¶ms) =0;
693 void ThrowIfInvalidKeyLength(
size_t length);
700 void ThrowIfResynchronizable();
709 void ThrowIfInvalidIV(
const byte *iv);
714 size_t ThrowIfInvalidIVLength(
int length);
748 virtual void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock,
byte *outBlock)
const =0;
759 {ProcessAndXorBlock(inBlock, NULL, outBlock);}
768 {ProcessAndXorBlock(inoutBlock, NULL, inoutBlock);}
772 virtual unsigned int BlockSize()
const =0;
776 virtual unsigned int OptimalDataAlignment()
const;
784 virtual bool IsForwardTransformation()
const =0;
794 BT_InBlockIsCounter=1,
796 BT_DontIncrementInOutPointers=2,
800 BT_ReverseDirection=8,
802 BT_AllowParallel=16};
812 virtual size_t AdvancedProcessBlocks(
const byte *inBlocks,
const byte *xorBlocks,
byte *outBlocks,
size_t length,
word32 flags)
const;
850 virtual unsigned int OptimalDataAlignment()
const;
857 virtual void ProcessData(
byte *outString,
const byte *inString,
size_t length) =0;
865 virtual void ProcessLastBlock(
byte *outString,
const byte *inString,
size_t length);
878 {ProcessData(inoutString, inoutString, length);}
886 {ProcessData(outString, inString, length);}
892 {ProcessData(&input, &input, 1);
return input;}
896 virtual bool IsRandomAccess()
const =0;
907 throw NotImplemented(
"StreamTransformation: this object doesn't support random access");
914 virtual bool IsSelfInverting()
const =0;
919 virtual bool IsForwardTransformation()
const =0;
943 virtual void Update(
const byte *input,
size_t length) =0;
961 {TruncatedFinal(digest, DigestSize());}
966 {TruncatedFinal(NULL, 0);}
970 virtual unsigned int DigestSize()
const =0;
975 unsigned int TagSize()
const {
return DigestSize();}
992 virtual unsigned int OptimalDataAlignment()
const;
1004 {Update(input, length); Final(digest);}
1016 {
return TruncatedVerify(digest, DigestSize());}
1032 {Update(input, length);
return Verify(digest);}
1039 virtual void TruncatedFinal(
byte *digest,
size_t digestSize) =0;
1052 {Update(input, length); TruncatedFinal(digest, digestSize);}
1064 virtual bool TruncatedVerify(
const byte *digest,
size_t digestLength);
1081 {Update(input, length);
return TruncatedVerify(digest, digestLength);}
1088 void ThrowIfInvalidTruncatedSize(
size_t size)
const;
1133 explicit BadState(
const std::string &
name,
const char *
function,
const char *state) :
Exception(OTHER_ERROR, name +
": " +
function +
" was called before " + state) {}
1138 virtual lword MaxHeaderLength()
const =0;
1141 virtual lword MaxMessageLength()
const =0;
1154 void SpecifyDataLengths(
lword headerLength,
lword messageLength,
lword footerLength=0);
1159 virtual void EncryptAndAuthenticate(
byte *ciphertext,
byte *mac,
size_t macSize,
const byte *iv,
int ivLength,
const byte *header,
size_t headerLength,
const byte *message,
size_t messageLength);
1164 virtual bool DecryptAndVerify(
byte *message,
const byte *mac,
size_t macLength,
const byte *iv,
int ivLength,
const byte *header,
size_t headerLength,
const byte *ciphertext,
size_t ciphertextLength);
1171 virtual std::string AlgorithmName()
const =0;
1204 throw NotImplemented(
"RandomNumberGenerator: IncorporateEntropy not implemented");
1216 virtual byte GenerateByte();
1223 virtual unsigned int GenerateBit();
1242 virtual void GenerateBlock(
byte *output,
size_t size);
1258 virtual void DiscardBytes(
size_t n);
1264 template <
class IT>
void Shuffle(IT begin, IT end)
1267 for (; begin != end; ++begin)
1268 std::iter_swap(begin, begin + GenerateWord32(0, end-begin-1));
1302 virtual unsigned int GetMaxWaitObjectCount()
const =0;
1318 bool Wait(
unsigned long milliseconds,
CallStack const& callStack);
1377 {
return Put(&inByte, 1, blocking);}
1385 size_t Put(
const byte *inString,
size_t length,
bool blocking=
true)
1386 {
return Put2(inString, length, 0, blocking);}
1412 {size=0;
return NULL;}
1427 {
return PutModifiable2(inString, length, 0, blocking);}
1435 {
return !!Put2(NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);}
1448 {
return Put2(inString, length, propagation < 0 ? -1 : propagation+1, blocking);}
1456 virtual size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking) =0;
1465 {
return Put2(inString, length, messageEnd, blocking);}
1476 unsigned int GetMaxWaitObjectCount()
const;
1505 throw NotImplemented(
"BufferedTransformation: this object can't be reinitialized");
1512 virtual bool IsolatedFlush(
bool hardFlush,
bool blocking) =0;
1544 virtual bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true);
1554 virtual bool MessageSeriesEnd(
int propagation=-1,
bool blocking=
true);
1581 virtual lword MaxRetrievable()
const;
1585 virtual bool AnyRetrievable()
const;
1591 virtual size_t Get(
byte &outByte);
1598 virtual size_t Get(
byte *outString,
size_t getMax);
1605 virtual size_t Peek(
byte &outByte)
const;
1613 virtual size_t Peek(
byte *outString,
size_t peekMax)
const;
1655 {TransferTo2(target, transferMax, channel);
return transferMax;}
1680 {
return CopyRangeTo(target, 0, copyMax, channel);}
1693 {
lword i = position; CopyRangeTo2(target, i, i+copyMax, channel);
return i-position;}
1705 virtual lword TotalBytesRetrievable()
const;
1711 virtual unsigned int NumberOfMessages()
const;
1716 virtual bool AnyMessages()
const;
1722 virtual bool GetNextMessage();
1729 virtual unsigned int SkipMessages(
unsigned int count=UINT_MAX);
1741 {TransferMessagesTo2(target,
count, channel);
return count;}
1755 virtual void SkipAll();
1764 {TransferAllTo2(target, channel);}
1865 {
return ChannelPut(channel, &inByte, 1, blocking);}
1874 size_t ChannelPut(
const std::string &channel,
const byte *inString,
size_t length,
bool blocking=
true)
1875 {
return ChannelPut2(channel, inString, length, 0, blocking);}
1885 {
return ChannelPutModifiable2(channel, inString, length, 0, blocking);}
1914 {
return !!ChannelPut2(channel, NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);}
1926 {
return ChannelPut2(channel, inString, length, propagation < 0 ? -1 : propagation+1, blocking);}
1939 virtual byte * ChannelCreatePutSpace(
const std::string &channel,
size_t &
size);
1948 virtual size_t ChannelPut2(
const std::string &channel,
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
1957 virtual size_t ChannelPutModifiable2(
const std::string &channel,
byte *inString,
size_t length,
int messageEnd,
bool blocking);
1967 virtual bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true);
1978 virtual bool ChannelMessageSeriesEnd(
const std::string &channel,
int propagation=-1,
bool blocking=
true);
1983 virtual void SetRetrievalChannel(
const std::string &channel);
1992 virtual bool Attachable() {
return false;}
2018 throw NotImplemented(
"BufferedTransformation: this object is not attachable");
2030 {
return propagation != 0 ? propagation - 1 : 0;}
2127 throw NotImplemented(
"CryptoMaterial: this object does not support precomputation");
2147 #if (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) 2149 char m_sunCCworkaround;
2168 throw NotImplemented(
"GeneratableCryptoMaterial: this object does not support key/parameter generation");
2213 {AccessMaterial().Load(bt);}
2219 {GetMaterial().Save(bt);}
2233 {
return AccessPublicKey();}
2237 {
return GetPublicKey();}
2241 virtual PublicKey & AccessPublicKey() =0;
2263 virtual PrivateKey & AccessPrivateKey() =0;
2284 virtual CryptoParameters & AccessCryptoParameters() =0;
2301 virtual size_t MaxPlaintextLength(
size_t ciphertextLength)
const =0;
2306 virtual size_t CiphertextLength(
size_t plaintextLength)
const =0;
2313 virtual bool ParameterSupported(
const char *
name)
const =0;
2357 const byte *plaintext,
size_t plaintextLength,
2392 const byte *ciphertext,
size_t ciphertextLength,
2418 {
return Decrypt(rng, ciphertext, FixedCiphertextLength(), plaintext,
parameters);}
2459 virtual size_t SignatureLength()
const =0;
2473 virtual size_t MaxRecoverableLength()
const =0;
2481 virtual size_t MaxRecoverableLengthFromSignatureLength(
size_t signatureLength)
const =0;
2487 virtual bool IsProbabilistic()
const =0;
2491 virtual bool AllowNonrecoverablePart()
const =0;
2503 virtual bool RecoverablePartFirst()
const =0;
2515 {
throw NotImplemented(
"PK_MessageAccumulator: DigestSize() should not be called");}
2521 throw NotImplemented(
"PK_MessageAccumulator: TruncatedFinal() should not be called");
2543 virtual void InputRecoverableMessage(
PK_MessageAccumulator &messageAccumulator,
const byte *recoverableMessage,
size_t recoverableMessageLength)
const =0;
2581 virtual size_t SignMessageWithRecovery(
RandomNumberGenerator &rng,
const byte *recoverableMessage,
size_t recoverableMessageLength,
2582 const byte *nonrecoverableMessage,
size_t nonrecoverableMessageLength,
byte *signature)
const;
2607 virtual void InputSignature(
PK_MessageAccumulator &messageAccumulator,
const byte *signature,
size_t signatureLength)
const =0;
2627 virtual bool VerifyMessage(
const byte *message,
size_t messageLen,
2628 const byte *signature,
size_t signatureLen)
const;
2655 const byte *nonrecoverableMessage,
size_t nonrecoverableMessageLength,
2656 const byte *signature,
size_t signatureLength)
const;
2671 virtual unsigned int AgreedValueLength()
const =0;
2675 virtual unsigned int PrivateKeyLength()
const =0;
2679 virtual unsigned int PublicKeyLength()
const =0;
2715 virtual bool Agree(
byte *agreedValue,
const byte *privateKey,
const byte *otherPublicKey,
bool validateOtherPublicKey=
true)
const =0;
2734 virtual unsigned int AgreedValueLength()
const =0;
2738 virtual unsigned int StaticPrivateKeyLength()
const =0;
2742 virtual unsigned int StaticPublicKeyLength()
const =0;
2768 virtual unsigned int EphemeralPrivateKeyLength()
const =0;
2772 virtual unsigned int EphemeralPublicKeyLength()
const =0;
2810 virtual bool Agree(
byte *agreedValue,
2811 const byte *staticPrivateKey,
const byte *ephemeralPrivateKey,
2812 const byte *staticOtherPublicKey,
const byte *ephemeralOtherPublicKey,
2813 bool validateStaticOtherPublicKey=
true)
const =0;
2844 class ProtocolSession
2851 ProtocolError(ErrorType errorType,
const std::string &s) :
Exception(errorType, s) {}
2856 class UnexpectedMethodCall :
public Exception 2859 UnexpectedMethodCall(
const std::string &s) :
Exception(OTHER_ERROR, s) {}
2862 virtual ~ProtocolSession() {}
2864 ProtocolSession() : m_rng(NULL), m_throwOnProtocolError(
true), m_validState(
false) {}
2868 bool GetThrowOnProtocolError()
const {
return m_throwOnProtocolError;}
2869 void SetThrowOnProtocolError(
bool throwOnProtocolError) {m_throwOnProtocolError = throwOnProtocolError;}
2871 bool HasValidState()
const {
return m_validState;}
2873 virtual bool OutgoingMessageAvailable()
const =0;
2874 virtual unsigned int GetOutgoingMessageLength()
const =0;
2875 virtual void GetOutgoingMessage(
byte *message) =0;
2877 virtual bool LastMessageProcessed()
const =0;
2878 virtual void ProcessIncomingMessage(
const byte *message,
unsigned int messageLength) =0;
2882 void CheckAndHandleInvalidState()
const;
2883 void SetValidState(
bool valid) {m_validState = valid;}
2888 bool m_throwOnProtocolError, m_validState;
2891 class KeyAgreementSession :
public ProtocolSession
2894 virtual ~KeyAgreementSession() {}
2896 virtual unsigned int GetAgreedValueLength()
const =0;
2897 virtual void GetAgreedValue(
byte *agreedValue)
const =0;
2900 class PasswordAuthenticatedKeyAgreementSession :
public KeyAgreementSession
2903 virtual ~PasswordAuthenticatedKeyAgreementSession() {}
2906 const byte *myId,
unsigned int myIdLength,
2907 const byte *counterPartyId,
unsigned int counterPartyIdLength,
2908 const byte *passwordOrVerifier,
unsigned int passwordOrVerifierLength);
2914 virtual ~PasswordAuthenticatedKeyAgreementDomain() {}
2918 {
return GetCryptoParameters().Validate(rng, 2);}
2920 virtual unsigned int GetPasswordVerifierLength(
const byte *password,
unsigned int passwordLength)
const =0;
2921 virtual void GeneratePasswordVerifier(
RandomNumberGenerator &rng,
const byte *userId,
unsigned int userIdLength,
const byte *password,
unsigned int passwordLength,
byte *verifier)
const =0;
2923 enum RoleFlags {CLIENT=1, SERVER=2, INITIATOR=4, RESPONDER=8};
2925 virtual bool IsValidRole(
unsigned int role) =0;
2926 virtual PasswordAuthenticatedKeyAgreementSession * CreateProtocolSession(
unsigned int role)
const =0;
2972 #if CRYPTOPP_MSC_VERSION 2973 # pragma warning(pop) Base class for all exceptions thrown by the library.
Exception thrown when invalid crypto material is detected.
const Algorithm & GetAlgorithm() const
Returns the base class Algorithm.
virtual void Precompute(unsigned int precomputationStorage)
Perform precomputation.
virtual const PublicKey & GetPublicKey() const
Retrieves a reference to a Public Key.
the cipher is performing decryption
An invalid argument was detected.
void SetKeyWithIV(const byte *key, size_t length, const byte *iv)
Sets or reset the key of this object.
bool GetThisObject(T &object) const
Get a copy of this object or subobject.
bool CanUseRandomIVs() const
Determines if the object can use random IVs.
const char * what() const
Retrieves a C-string describing the exception.
Interface for message authentication codes.
ErrorType
Error types or categories.
NotImplemented(const std::string &s)
#define function(a, b, c, d, k, s)
virtual void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
Interface for asymmetric algorithms.
void GetRequiredParameter(const char *className, const char *name, T &value) const
Retrieves a required name/value pair.
const Algorithm & GetAlgorithm() const
Returns the base class Algorithm.
const std::type_info & m_stored
Interface for public-key encryptors and decryptors.
ByteOrder
Provides the byte ordering.
virtual ~NameValuePairs()
The IV is set by the object.
The operating system reported an error.
virtual ~RandomNumberGenerator()
CRYPTOPP_DLL const std::string AAD_CHANNEL
Channel for additional authenticated data.
Interface for one direction (encryption or decryption) of a stream cipher or block cipher mode with a...
CRYPTOPP_DLL void GetRequiredIntParameter(const char *className, const char *name, int &value) const
Retrieves a required name/value pair.
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
virtual void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
Exception(ErrorType errorType, const std::string &s)
Construct a new Exception.
ErrorType GetErrorType() const
Retrieves the error type for the exception.
virtual bool NeedsPrespecifiedDataLengths() const
Determines if data lengths must be specified prior to inputting data.
bool operator!=(const DecodingResult &rhs) const
Compare two DecodingResult.
Exception thrown when the object is in the wrong state for the operation.
#define NAMESPACE_BEGIN(x)
Interface for public-key signers.
virtual void ThrowIfInvalid(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Interface for public-key encryptors.
CRYPTOPP_DLL bool GetIntValue(const char *name, int &value) const
Get a named value with type int.
Converts an enumeration to a type suitable for use as a template parameter.
CipherDir
Specifies a direction for a cipher to operate.
void BERDecode(BufferedTransformation &bt)
Loads this object from a BufferedTransformation.
Flush(true) was called but it can't completely flush its buffers.
virtual void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
Thrown when an unexpected type is encountered.
CryptoMaterial & AccessMaterial()
Retrieves a reference to a Private Key.
Interface for asymmetric algorithms using private keys.
bool operator==(const DecodingResult &rhs) const
Compare two DecodingResult.
virtual bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
const std::string & GetWhat() const
Retrieves a string describing the exception.
ValueTypeMismatch(const std::string &name, const std::type_info &stored, const std::type_info &retrieving)
Construct a ValueTypeMismatch.
EnumToType< ByteOrder, LITTLE_ENDIAN_ORDER > LittleEndian
Provides a constant for LittleEndian.
BadState(const std::string &name, const char *function, const char *state)
Library configuration file.
virtual bool CanIncorporateEntropy() const
Determines if a generator can accept additional entropy.
Interface for random number generators.
size_t messageLength
Recovered message length if isValidCoding is true, undefined otherwise.
virtual lword MaxFooterLength() const
Provides the the maximum length of AAD.
InvalidMaterial(const std::string &s)
OS_Error(ErrorType errorType, const std::string &s, const std::string &operation, int errorCode)
Interface for private keys.
Interface for cloning objects.
virtual unsigned int MinIVLength() const
Provides the minimum size of an IV.
const CryptoMaterial & GetMaterial() const
Retrieves a reference to a Private Key.
virtual ~SimpleKeyAgreementDomain()
const std::type_info & GetRetrievingTypeInfo() const
Provides the retrieveing type.
virtual ~PK_SignatureScheme()
Data integerity check, such as CRC or MAC, failed.
#define DOCUMENTED_NAMESPACE_END
byte order is little-endian
bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
Interface for one direction (encryption or decryption) of a block cipher.
CRYPTOPP_DLL RandomNumberGenerator &CRYPTOPP_API NullRNG()
Random Number Generator that does not produce random numbers.
const Algorithm & GetAlgorithm() const
Returns the base class Algorithm.
void SetWhat(const std::string &s)
Sets the error string for the exception.
Interface for objects that can be waited on.
the cipher is performing encryption
const std::string & GetOperation() const
Retrieve the operating system API that reported the error.
Interface for domains of simple key agreement protocols.
virtual void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength)
Returns a decoding results.
virtual void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
virtual ~PublicKeyAlgorithm()
Exception thrown when trying to encrypt plaintext of invalid length.
bool CanUsePredictableIVs() const
Determines if the object can use random but possibly predictable IVs.
DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *ciphertext, byte *plaintext, const NameValuePairs ¶meters=g_nullNameValuePairs) const
Decrypt a fixed size ciphertext.
Input data was received that did not conform to expected format.
bool GetValue(const char *name, T &value) const
Get a named value.
Interface for public-key decryptors.
bool GetThisPointer(T *&ptr) const
Get a pointer to this object.
A method was called which was not implemented.
Exception throw when the private or public key is too short to sign or verify.
virtual ~PK_CryptoSystem()
virtual size_t FixedCiphertextLength() const
Provides the fixed ciphertext length, if one exists.
bool IsResynchronizable() const
Determines if the object can be resynchronized.
const CryptoMaterial & GetMaterial() const
Retrieves a reference to Crypto Parameters.
const std::type_info & GetStoredTypeInfo() const
Provides the stored type.
Interface for encoding and decoding ASN1 objects.
CRYPTOPP_DLL int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
virtual void Resynchronize(const byte *iv, int ivLength=-1)
Resynchronize with an IV.
virtual size_t MaxSignatureLength(size_t recoverablePartLength=0) const
Provides the maximum signature length produced given the length of the recoverable message part...
DecodingResult()
Constructs a DecodingResult.
virtual ~CryptoMaterial()
bool CanUseStructuredIVs() const
Determines if the object can use structured IVs.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
bool Validate(int, bool, const char *)
Multiple precision integer with arithmetic operations.
DecodingResult(size_t len)
Constructs a DecodingResult.
virtual ~GeneratableCryptoMaterial()
virtual ~PrivateKeyAlgorithm()
Exception throw when the private or public key has a length that can't be used.
Interface for algorithms that take byte strings as keys.
virtual std::string AlgorithmName() const
Provides the name of this algorithm.
virtual const CryptoParameters & GetCryptoParameters() const
Retrieves a reference to Crypto Parameters.
CannotFlush(const std::string &s)
Interface for asymmetric algorithms using public keys.
virtual size_t FixedMaxPlaintextLength() const
Provides the maximum plaintext length given a fixed ciphertext length.
const CryptoMaterial & GetMaterial() const
Retrieves a reference to a Public Key.
CRYPTOPP_DLL const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
void AssertValidKeyLength(size_t length) const
Validates the key length.
unsigned int DigestSize() const
virtual ~AuthenticatedKeyAgreementDomain()
Interface for public-key signers and verifiers.
#define DOCUMENTED_NAMESPACE_BEGIN(x)
int GetErrorCode() const
Retrieve the error code returned by the operating system.
BadState(const std::string &name, const char *message)
virtual const PrivateKey & GetPrivateKey() const
Retrieves a reference to a Private Key.
InvalidKeyLength(const std::string &message)
#define CRYPTOPP_ASSERT(exp)
CRYPTOPP_DLL const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
HashTransformation HashFunction
const unsigned long INFINITE_TIME
Represents infinite time.
#define CRYPTOPP_NO_VTABLE
virtual unsigned int MaxIVLength() const
Provides the maximum size of an IV.
Interface for all crypto algorithms.
unsigned int DefaultIVLength() const
Provides the default size of an IV.
virtual bool IsValidKeyLength(size_t keylength) const
Returns whether keylength is a valid key length.
virtual void BEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
Interface for accumulating messages to be signed or verified.
virtual Clonable * Clone() const
Copies this object.
A decryption filter encountered invalid ciphertext.
Interface for key agreement algorithms.
virtual ~AuthenticatedSymmetricCipher()
IV_Requirement
Secure IVs requirements as enumerated values.
CryptoMaterial & AccessMaterial()
Retrieves a reference to a Public Key.
Interface for public-key signature verifiers.
virtual ~SimpleKeyingInterface()
uint8_t const size_t const size
void Shuffle(IT begin, IT end)
Randomly shuffle the specified array.
#define CRYPTOPP_UNUSED(x)
virtual bool SignatureUpfront() const
Determines whether the signature must be input before the message.
Debugging and diagnostic assertions.
InvalidArgument(const std::string &s)
Interface for crypto material, such as public and private keys, and crypto parameters.
virtual void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms=g_nullNameValuePairs)
Generate a random key or crypto parameters.
void DEREncode(BufferedTransformation &bt) const
Saves this object to a BufferedTransformation.
CryptoMaterial & AccessMaterial()
Retrieves a reference to Crypto Parameters.
An invalid argument was detected.
Interface for generatable crypto material, such as private keys and crypto parameters.
Interface for crypto prameters.
CRYPTOPP_DLL BufferedTransformation & TheBitBucket()
An input discarding BufferedTransformation.
BERDecodeErr(const std::string &s)
std::vector< char * > parameters
bool isValidCoding
Flag to indicate the decoding is valid.
BufferedTransformation received a Flush(true) signal but can't flush buffers.
void SetErrorType(ErrorType errorType)
Sets the error type for the exceptions.
Interface for public keys.
CRYPTOPP_DLL std::string GetValueNames() const
Get a list of value names that can be retrieved.
The IV must be random and unpredictable.
Interface for domains of authenticated key agreement protocols.
const Algorithm & GetAlgorithm() const
Returns the base class Algorithm.
void TruncatedFinal(byte *digest, size_t digestSize)
A method was called which was not implemented.
const std::type_info & m_retrieving
Error reading from input device or writing to output device.
virtual ~KeyAgreementAlgorithm()
static ENUM_TYPE ToEnum()
virtual unsigned int IVSize() const
Returns length of the IV accepted by this object.
static CRYPTOPP_DLL void CRYPTOPP_API ThrowIfTypeMismatch(const char *name, const std::type_info &stored, const std::type_info &retrieving)
Ensures an expected name and type is present.
EnumToType< ByteOrder, BIG_ENDIAN_ORDER > BigEndian
Provides a constant for BigEndian.
virtual void IncorporateEntropy(const byte *input, size_t length)
Update RNG state with additional unpredictable values.
InvalidCiphertext(const std::string &s)
virtual ~AsymmetricAlgorithm()
Interface for retrieving values given their names.
Exception thrown when an ASN.1 BER decoing error is encountered.
The IV must be random and possibly predictable.
void DoQuickSanityCheck() const
Perform a quick sanity check.