Updated documentation (Issue 248)
parent
15ec4ef713
commit
fcdc845bba
18
cryptlib.cpp
18
cryptlib.cpp
|
|
@ -184,7 +184,7 @@ size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const by
|
||||||
assert(inBlocks);
|
assert(inBlocks);
|
||||||
assert(outBlocks);
|
assert(outBlocks);
|
||||||
assert(length);
|
assert(length);
|
||||||
|
|
||||||
size_t blockSize = BlockSize();
|
size_t blockSize = BlockSize();
|
||||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||||
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||||
|
|
@ -262,7 +262,7 @@ void AuthenticatedSymmetricCipher::SpecifyDataLengths(lword headerLength, lword
|
||||||
|
|
||||||
if (messageLength > MaxMessageLength())
|
if (messageLength > MaxMessageLength())
|
||||||
throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength()));
|
throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength()));
|
||||||
|
|
||||||
if (footerLength > MaxFooterLength())
|
if (footerLength > MaxFooterLength())
|
||||||
throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": footer length " + IntToString(footerLength) + " exceeds the maximum of " + IntToString(MaxFooterLength()));
|
throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": footer length " + IntToString(footerLength) + " exceeds the maximum of " + IntToString(MaxFooterLength()));
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ word32 RandomNumberGenerator::GenerateWord32(word32 min, word32 max)
|
||||||
// Stack recursion below... GenerateIntoBufferedTransformation calls GenerateBlock,
|
// Stack recursion below... GenerateIntoBufferedTransformation calls GenerateBlock,
|
||||||
// and GenerateBlock calls GenerateIntoBufferedTransformation. Ad infinitum. Also
|
// and GenerateBlock calls GenerateIntoBufferedTransformation. Ad infinitum. Also
|
||||||
// see https://github.com/weidai11/cryptopp/issues/38.
|
// see https://github.com/weidai11/cryptopp/issues/38.
|
||||||
//
|
//
|
||||||
// According to Wei, RandomNumberGenerator is an interface, and it should not
|
// According to Wei, RandomNumberGenerator is an interface, and it should not
|
||||||
// be instantiable. Its now spilt milk, and we are going to assert it in Debug
|
// be instantiable. Its now spilt milk, and we are going to assert it in Debug
|
||||||
// builds to alert the programmer and throw in Release builds. Developers have
|
// builds to alert the programmer and throw in Release builds. Developers have
|
||||||
|
|
@ -369,7 +369,7 @@ public:
|
||||||
//! \brief The name of the generator
|
//! \brief The name of the generator
|
||||||
//! \returns the string \a NullRNGs
|
//! \returns the string \a NullRNGs
|
||||||
std::string AlgorithmName() const {return "NullRNG";}
|
std::string AlgorithmName() const {return "NullRNG";}
|
||||||
|
|
||||||
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
//! \brief An implementation that throws NotImplemented
|
//! \brief An implementation that throws NotImplemented
|
||||||
byte GenerateByte () {}
|
byte GenerateByte () {}
|
||||||
|
|
@ -397,7 +397,7 @@ public:
|
||||||
void DiscardBytes (size_t n) {}
|
void DiscardBytes (size_t n) {}
|
||||||
//! \brief An implementation that does nothing
|
//! \brief An implementation that does nothing
|
||||||
void Shuffle (IT begin, IT end) {}
|
void Shuffle (IT begin, IT end) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Clonable* Clone () const { return NULL; }
|
Clonable* Clone () const { return NULL; }
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -801,7 +801,7 @@ public:
|
||||||
m_ciphertext.resize(ciphertextLength);
|
m_ciphertext.resize(ciphertextLength);
|
||||||
m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters);
|
m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd);
|
FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd);
|
||||||
}
|
}
|
||||||
FILTER_END_NO_MESSAGE_END;
|
FILTER_END_NO_MESSAGE_END;
|
||||||
|
|
@ -880,7 +880,7 @@ size_t PK_Signer::SignMessage(RandomNumberGenerator &rng, const byte *message, s
|
||||||
return SignAndRestart(rng, *m, signature, false);
|
return SignAndRestart(rng, *m, signature, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PK_Signer::SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength,
|
size_t PK_Signer::SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength,
|
||||||
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const
|
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const
|
||||||
{
|
{
|
||||||
member_ptr<PK_MessageAccumulator> m(NewSignatureAccumulator(rng));
|
member_ptr<PK_MessageAccumulator> m(NewSignatureAccumulator(rng));
|
||||||
|
|
@ -909,8 +909,8 @@ DecodingResult PK_Verifier::Recover(byte *recoveredMessage, PK_MessageAccumulato
|
||||||
return RecoverAndRestart(recoveredMessage, *m);
|
return RecoverAndRestart(recoveredMessage, *m);
|
||||||
}
|
}
|
||||||
|
|
||||||
DecodingResult PK_Verifier::RecoverMessage(byte *recoveredMessage,
|
DecodingResult PK_Verifier::RecoverMessage(byte *recoveredMessage,
|
||||||
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
|
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
|
||||||
const byte *signature, size_t signatureLength) const
|
const byte *signature, size_t signatureLength) const
|
||||||
{
|
{
|
||||||
member_ptr<PK_MessageAccumulator> m(NewVerificationAccumulator());
|
member_ptr<PK_MessageAccumulator> m(NewVerificationAccumulator());
|
||||||
|
|
|
||||||
165
cryptlib.h
165
cryptlib.h
|
|
@ -161,7 +161,7 @@ public:
|
||||||
//! \brief Construct a new Exception
|
//! \brief Construct a new Exception
|
||||||
explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {}
|
explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {}
|
||||||
virtual ~Exception() throw() {}
|
virtual ~Exception() throw() {}
|
||||||
|
|
||||||
//! \brief Retrieves a C-string describing the exception
|
//! \brief Retrieves a C-string describing the exception
|
||||||
const char *what() const throw() {return (m_what.c_str());}
|
const char *what() const throw() {return (m_what.c_str());}
|
||||||
//! \brief Retrieves a string describing the exception
|
//! \brief Retrieves a string describing the exception
|
||||||
|
|
@ -269,7 +269,7 @@ struct CRYPTOPP_DLL DecodingResult
|
||||||
//! and to read values from keys and crypto parameters.
|
//! and to read values from keys and crypto parameters.
|
||||||
//! \details To obtain an object that implements NameValuePairs for the purpose of parameter
|
//! \details To obtain an object that implements NameValuePairs for the purpose of parameter
|
||||||
//! passing, use the MakeParameters() function.
|
//! passing, use the MakeParameters() function.
|
||||||
//! \details To get a value from NameValuePairs, you need to know the name and the type of the value.
|
//! \details To get a value from NameValuePairs, you need to know the name and the type of the value.
|
||||||
//! Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports.
|
//! Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports.
|
||||||
//! then look at the Name namespace documentation to see what the type of each value is, or
|
//! then look at the Name namespace documentation to see what the type of each value is, or
|
||||||
//! alternatively, call GetIntValue() with the value name, and if the type is not int, a
|
//! alternatively, call GetIntValue() with the value name, and if the type is not int, a
|
||||||
|
|
@ -296,7 +296,7 @@ public:
|
||||||
//! \brief Provides the stored type
|
//! \brief Provides the stored type
|
||||||
//! \return the C++ mangled name of the type
|
//! \return the C++ mangled name of the type
|
||||||
const std::type_info & GetStoredTypeInfo() const {return m_stored;}
|
const std::type_info & GetStoredTypeInfo() const {return m_stored;}
|
||||||
|
|
||||||
//! \brief Provides the retrieveing type
|
//! \brief Provides the retrieveing type
|
||||||
//! \return the C++ mangled name of the type
|
//! \return the C++ mangled name of the type
|
||||||
const std::type_info & GetRetrievingTypeInfo() const {return m_retrieving;}
|
const std::type_info & GetRetrievingTypeInfo() const {return m_retrieving;}
|
||||||
|
|
@ -423,7 +423,7 @@ public:
|
||||||
if (!GetIntValue(name, value))
|
if (!GetIntValue(name, value))
|
||||||
throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'");
|
throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Get a named value
|
//! \brief Get a named value
|
||||||
//! \param name the name of the object or value to retrieve
|
//! \param name the name of the object or value to retrieve
|
||||||
//! \param valueType reference to a variable that receives the value
|
//! \param valueType reference to a variable that receives the value
|
||||||
|
|
@ -481,7 +481,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Clonable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Clonable() {}
|
virtual ~Clonable() {}
|
||||||
|
|
||||||
//! \brief Copies this object
|
//! \brief Copies this object
|
||||||
//! \return a copy of this object
|
//! \return a copy of this object
|
||||||
//! \throws NotImplemented
|
//! \throws NotImplemented
|
||||||
|
|
@ -508,7 +508,7 @@ public:
|
||||||
//! versions of the library when the library is built as a DLL on Windows. Also see
|
//! versions of the library when the library is built as a DLL on Windows. Also see
|
||||||
//! CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 in config.h.
|
//! CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 in config.h.
|
||||||
Algorithm(bool checkSelfTestStatus = true);
|
Algorithm(bool checkSelfTestStatus = true);
|
||||||
|
|
||||||
//! \brief Provides the name of this algorithm
|
//! \brief Provides the name of this algorithm
|
||||||
//! \return the standard algorithm name
|
//! \return the standard algorithm name
|
||||||
//! \details The standard algorithm name can be a name like \a AES or \a AES/GCM. Some algorithms
|
//! \details The standard algorithm name can be a name like \a AES or \a AES/GCM. Some algorithms
|
||||||
|
|
@ -609,16 +609,16 @@ public:
|
||||||
//! \note If this function returns true, and no IV is passed to SetKey() and <tt>CanUseStructuredIVs()==true</tt>,
|
//! \note If this function returns true, and no IV is passed to SetKey() and <tt>CanUseStructuredIVs()==true</tt>,
|
||||||
//! an IV of all 0's will be assumed.
|
//! an IV of all 0's will be assumed.
|
||||||
bool IsResynchronizable() const {return IVRequirement() < NOT_RESYNCHRONIZABLE;}
|
bool IsResynchronizable() const {return IVRequirement() < NOT_RESYNCHRONIZABLE;}
|
||||||
|
|
||||||
//! \brief Determines if the object can use random IVs
|
//! \brief Determines if the object can use random IVs
|
||||||
//! \return true if the object can use random IVs (in addition to ones returned by GetNextIV), false otherwise
|
//! \return true if the object can use random IVs (in addition to ones returned by GetNextIV), false otherwise
|
||||||
bool CanUseRandomIVs() const {return IVRequirement() <= UNPREDICTABLE_RANDOM_IV;}
|
bool CanUseRandomIVs() const {return IVRequirement() <= UNPREDICTABLE_RANDOM_IV;}
|
||||||
|
|
||||||
//! \brief Determines if the object can use random but possibly predictable IVs
|
//! \brief Determines if the object can use random but possibly predictable IVs
|
||||||
//! \return true if the object can use random but possibly predictable IVs (in addition to ones returned by
|
//! \return true if the object can use random but possibly predictable IVs (in addition to ones returned by
|
||||||
//! GetNextIV), false otherwise
|
//! GetNextIV), false otherwise
|
||||||
bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;}
|
bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;}
|
||||||
|
|
||||||
//! \brief Determines if the object can use structured IVs
|
//! \brief Determines if the object can use structured IVs
|
||||||
//! returns whether the object can use structured IVs, for example a counter (in addition to ones returned by
|
//! returns whether the object can use structured IVs, for example a counter (in addition to ones returned by
|
||||||
//! GetNextIV), false otherwise
|
//! GetNextIV), false otherwise
|
||||||
|
|
@ -634,12 +634,12 @@ public:
|
||||||
//! \brief Provides the default size of an IV
|
//! \brief Provides the default size of an IV
|
||||||
//! \return default length of IVs accepted by this object, in bytes
|
//! \return default length of IVs accepted by this object, in bytes
|
||||||
unsigned int DefaultIVLength() const {return IVSize();}
|
unsigned int DefaultIVLength() const {return IVSize();}
|
||||||
|
|
||||||
//! \brief Provides the minimum size of an IV
|
//! \brief Provides the minimum size of an IV
|
||||||
//! \return minimal length of IVs accepted by this object, in bytes
|
//! \return minimal length of IVs accepted by this object, in bytes
|
||||||
//! \throws NotImplemented() if the object does not support resynchronization
|
//! \throws NotImplemented() if the object does not support resynchronization
|
||||||
virtual unsigned int MinIVLength() const {return IVSize();}
|
virtual unsigned int MinIVLength() const {return IVSize();}
|
||||||
|
|
||||||
//! \brief Provides the maximum size of an IV
|
//! \brief Provides the maximum size of an IV
|
||||||
//! \return maximal length of IVs accepted by this object, in bytes
|
//! \return maximal length of IVs accepted by this object, in bytes
|
||||||
//! \throws NotImplemented() if the object does not support resynchronization
|
//! \throws NotImplemented() if the object does not support resynchronization
|
||||||
|
|
@ -670,26 +670,26 @@ protected:
|
||||||
//! \brief Returns the base class Algorithm
|
//! \brief Returns the base class Algorithm
|
||||||
//! \return the base class Algorithm
|
//! \return the base class Algorithm
|
||||||
virtual const Algorithm & GetAlgorithm() const =0;
|
virtual const Algorithm & GetAlgorithm() const =0;
|
||||||
|
|
||||||
//! \brief Sets the key for this object without performing parameter validation
|
//! \brief Sets the key for this object without performing parameter validation
|
||||||
//! \param key a byte buffer used to key the cipher
|
//! \param key a byte buffer used to key the cipher
|
||||||
//! \param length the length of the byte buffer
|
//! \param length the length of the byte buffer
|
||||||
//! \param params additional parameters passed as NameValuePairs
|
//! \param params additional parameters passed as NameValuePairs
|
||||||
//! \details key must be at least DEFAULT_KEYLENGTH in length.
|
//! \details key must be at least DEFAULT_KEYLENGTH in length.
|
||||||
virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) =0;
|
virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) =0;
|
||||||
|
|
||||||
//! \brief Validates the key length
|
//! \brief Validates the key length
|
||||||
//! \param length the size of the keying material, in bytes
|
//! \param length the size of the keying material, in bytes
|
||||||
//! \throws InvalidKeyLength if the key length is invalid
|
//! \throws InvalidKeyLength if the key length is invalid
|
||||||
void ThrowIfInvalidKeyLength(size_t length);
|
void ThrowIfInvalidKeyLength(size_t length);
|
||||||
|
|
||||||
//! \brief Validates the object
|
//! \brief Validates the object
|
||||||
//! \throws InvalidArgument if the IV is present
|
//! \throws InvalidArgument if the IV is present
|
||||||
//! \details Internally, the default implementation calls IsResynchronizable() and throws
|
//! \details Internally, the default implementation calls IsResynchronizable() and throws
|
||||||
//! InvalidArgument if the function returns true.
|
//! InvalidArgument if the function returns true.
|
||||||
//! \note called when no IV is passed
|
//! \note called when no IV is passed
|
||||||
void ThrowIfResynchronizable();
|
void ThrowIfResynchronizable();
|
||||||
|
|
||||||
//! \brief Validates the IV
|
//! \brief Validates the IV
|
||||||
//! \param iv the IV with a length of IVSize, in bytes
|
//! \param iv the IV with a length of IVSize, in bytes
|
||||||
//! \throws InvalidArgument on failure
|
//! \throws InvalidArgument on failure
|
||||||
|
|
@ -698,19 +698,19 @@ protected:
|
||||||
//! UNPREDICTABLE_RANDOM_IV. If IVRequirement is UNPREDICTABLE_RANDOM_IV, then
|
//! UNPREDICTABLE_RANDOM_IV. If IVRequirement is UNPREDICTABLE_RANDOM_IV, then
|
||||||
//! then the function succeeds. Otherwise, an exception is thrown.
|
//! then the function succeeds. Otherwise, an exception is thrown.
|
||||||
void ThrowIfInvalidIV(const byte *iv);
|
void ThrowIfInvalidIV(const byte *iv);
|
||||||
|
|
||||||
//! \brief Validates the IV length
|
//! \brief Validates the IV length
|
||||||
//! \param length the size of an IV, in bytes
|
//! \param length the size of an IV, in bytes
|
||||||
//! \throws InvalidArgument if the number of rounds are invalid
|
//! \throws InvalidArgument if the number of rounds are invalid
|
||||||
size_t ThrowIfInvalidIVLength(int length);
|
size_t ThrowIfInvalidIVLength(int length);
|
||||||
|
|
||||||
//! \brief Retrieves and validates the IV
|
//! \brief Retrieves and validates the IV
|
||||||
//! \param params NameValuePairs with the IV supplied as a ConstByteArrayParameter
|
//! \param params NameValuePairs with the IV supplied as a ConstByteArrayParameter
|
||||||
//! \param size the length of the IV, in bytes
|
//! \param size the length of the IV, in bytes
|
||||||
//! \return a pointer to the first byte of the IV
|
//! \return a pointer to the first byte of the IV
|
||||||
//! \throws InvalidArgument if the number of rounds are invalid
|
//! \throws InvalidArgument if the number of rounds are invalid
|
||||||
const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size);
|
const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size);
|
||||||
|
|
||||||
//! \brief Validates the key length
|
//! \brief Validates the key length
|
||||||
//! \param length the size of the keying material, in bytes
|
//! \param length the size of the keying material, in bytes
|
||||||
inline void AssertValidKeyLength(size_t length) const
|
inline void AssertValidKeyLength(size_t length) const
|
||||||
|
|
@ -787,11 +787,11 @@ public:
|
||||||
BT_InBlockIsCounter=1,
|
BT_InBlockIsCounter=1,
|
||||||
//! \brief should not modify block pointers
|
//! \brief should not modify block pointers
|
||||||
BT_DontIncrementInOutPointers=2,
|
BT_DontIncrementInOutPointers=2,
|
||||||
//! \brief
|
//! \brief
|
||||||
BT_XorInput=4,
|
BT_XorInput=4,
|
||||||
//! \brief perform the transformation in reverse
|
//! \brief perform the transformation in reverse
|
||||||
BT_ReverseDirection=8,
|
BT_ReverseDirection=8,
|
||||||
//! \brief
|
//! \brief
|
||||||
BT_AllowParallel=16};
|
BT_AllowParallel=16};
|
||||||
|
|
||||||
//! \brief Encrypt and xor multiple blocks using additional flags
|
//! \brief Encrypt and xor multiple blocks using additional flags
|
||||||
|
|
@ -835,11 +835,11 @@ public:
|
||||||
//! \note Optimal input length is
|
//! \note Optimal input length is
|
||||||
//! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>.
|
//! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>.
|
||||||
virtual unsigned int OptimalBlockSize() const {return MandatoryBlockSize();}
|
virtual unsigned int OptimalBlockSize() const {return MandatoryBlockSize();}
|
||||||
|
|
||||||
//! \brief Provides the number of bytes used in the current block when processing at optimal block size.
|
//! \brief Provides the number of bytes used in the current block when processing at optimal block size.
|
||||||
//! \return the number of bytes used in the current block when processing at the optimal block size
|
//! \return the number of bytes used in the current block when processing at the optimal block size
|
||||||
virtual unsigned int GetOptimalBlockSizeUsed() const {return 0;}
|
virtual unsigned int GetOptimalBlockSizeUsed() const {return 0;}
|
||||||
|
|
||||||
//! \brief Provides input and output data alignment for optimal performance.
|
//! \brief Provides input and output data alignment for optimal performance.
|
||||||
//! \return the input data alignment that provides optimal performance
|
//! \return the input data alignment that provides optimal performance
|
||||||
virtual unsigned int OptimalDataAlignment() const;
|
virtual unsigned int OptimalDataAlignment() const;
|
||||||
|
|
@ -901,7 +901,7 @@ public:
|
||||||
|
|
||||||
//! \brief Determines whether the cipher is self-inverting
|
//! \brief Determines whether the cipher is self-inverting
|
||||||
//! \returns true if the cipher is self-inverting, false otherwise
|
//! \returns true if the cipher is self-inverting, false otherwise
|
||||||
//! \details IsSelfInverting determines whether this transformation is
|
//! \details IsSelfInverting determines whether this transformation is
|
||||||
//! self-inverting (e.g. xor with a keystream).
|
//! self-inverting (e.g. xor with a keystream).
|
||||||
virtual bool IsSelfInverting() const =0;
|
virtual bool IsSelfInverting() const =0;
|
||||||
|
|
||||||
|
|
@ -967,7 +967,7 @@ public:
|
||||||
//! \return the tag size of the hash.
|
//! \return the tag size of the hash.
|
||||||
//! \details Same as DigestSize().
|
//! \details Same as DigestSize().
|
||||||
unsigned int TagSize() const {return DigestSize();}
|
unsigned int TagSize() const {return DigestSize();}
|
||||||
|
|
||||||
//! \brief Provides the block size of the compression function
|
//! \brief Provides the block size of the compression function
|
||||||
//! \return the block size of the compression function, in bytes
|
//! \return the block size of the compression function, in bytes
|
||||||
//! \details BlockSize() will return 0 if the hash is not block based. For example,
|
//! \details BlockSize() will return 0 if the hash is not block based. For example,
|
||||||
|
|
@ -984,7 +984,7 @@ public:
|
||||||
//! \brief Provides input and output data alignment for optimal performance
|
//! \brief Provides input and output data alignment for optimal performance
|
||||||
//! \return the input data alignment that provides optimal performance
|
//! \return the input data alignment that provides optimal performance
|
||||||
virtual unsigned int OptimalDataAlignment() const;
|
virtual unsigned int OptimalDataAlignment() const;
|
||||||
|
|
||||||
//! \brief Updates the hash with additional input and computes the hash of the current message
|
//! \brief Updates the hash with additional input and computes the hash of the current message
|
||||||
//! \param digest a pointer to the buffer to receive the hash
|
//! \param digest a pointer to the buffer to receive the hash
|
||||||
//! \param input the additional input as a buffer
|
//! \param input the additional input as a buffer
|
||||||
|
|
@ -996,7 +996,7 @@ public:
|
||||||
//! the output byte buffer is large enough for the digest.
|
//! the output byte buffer is large enough for the digest.
|
||||||
virtual void CalculateDigest(byte *digest, const byte *input, size_t length)
|
virtual void CalculateDigest(byte *digest, const byte *input, size_t length)
|
||||||
{Update(input, length); Final(digest);}
|
{Update(input, length); Final(digest);}
|
||||||
|
|
||||||
//! \brief Verifies the hash of the current message
|
//! \brief Verifies the hash of the current message
|
||||||
//! \param digest a pointer to the buffer of an \a existing hash
|
//! \param digest a pointer to the buffer of an \a existing hash
|
||||||
//! \return \p true if the existing hash matches the computed hash, \p false otherwise
|
//! \return \p true if the existing hash matches the computed hash, \p false otherwise
|
||||||
|
|
@ -1146,7 +1146,7 @@ public:
|
||||||
//! This is the case for some schemes, such as CCM.
|
//! This is the case for some schemes, such as CCM.
|
||||||
//! \sa SpecifyDataLengths()
|
//! \sa SpecifyDataLengths()
|
||||||
virtual bool NeedsPrespecifiedDataLengths() const {return false;}
|
virtual bool NeedsPrespecifiedDataLengths() const {return false;}
|
||||||
//! \brief Prespecifies the data lengths
|
//! \brief Prespecifies the data lengths
|
||||||
//! \details this function only needs to be called if NeedsPrespecifiedDataLengths() returns true
|
//! \details this function only needs to be called if NeedsPrespecifiedDataLengths() returns true
|
||||||
//! \sa NeedsPrespecifiedDataLengths()
|
//! \sa NeedsPrespecifiedDataLengths()
|
||||||
void SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength=0);
|
void SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength=0);
|
||||||
|
|
@ -1192,7 +1192,7 @@ public:
|
||||||
|
|
||||||
//! \brief Update RNG state with additional unpredictable values
|
//! \brief Update RNG state with additional unpredictable values
|
||||||
//! \param input the entropy to add to the generator
|
//! \param input the entropy to add to the generator
|
||||||
//! \param length the size of the input buffer
|
//! \param length the size of the input buffer
|
||||||
//! \throws NotImplemented
|
//! \throws NotImplemented
|
||||||
//! \details A generator may or may not accept additional entropy. Call CanIncorporateEntropy() to test for the
|
//! \details A generator may or may not accept additional entropy. Call CanIncorporateEntropy() to test for the
|
||||||
//! ability to use additional entropy.
|
//! ability to use additional entropy.
|
||||||
|
|
@ -1281,7 +1281,7 @@ public:
|
||||||
//! \brief Random Number Generator that does not produce random numbers
|
//! \brief Random Number Generator that does not produce random numbers
|
||||||
//! \return reference that can be passed to functions that require a RandomNumberGenerator
|
//! \return reference that can be passed to functions that require a RandomNumberGenerator
|
||||||
//! \details NullRNG() returns a reference that can be passed to functions that require a
|
//! \details NullRNG() returns a reference that can be passed to functions that require a
|
||||||
//! RandomNumberGenerator but don't actually use it. The NullRNG() throws NotImplemented
|
//! RandomNumberGenerator but don't actually use it. The NullRNG() throws NotImplemented
|
||||||
//! when a generation function is called.
|
//! when a generation function is called.
|
||||||
//! \sa ClassNullRNG, PK_SignatureScheme::IsProbabilistic()
|
//! \sa ClassNullRNG, PK_SignatureScheme::IsProbabilistic()
|
||||||
CRYPTOPP_DLL RandomNumberGenerator & CRYPTOPP_API NullRNG();
|
CRYPTOPP_DLL RandomNumberGenerator & CRYPTOPP_API NullRNG();
|
||||||
|
|
@ -1393,7 +1393,7 @@ public:
|
||||||
//! \param blocking specifies whether the object should block when processing input
|
//! \param blocking specifies whether the object should block when processing input
|
||||||
//! \return the number of bytes that remain in the block (i.e., bytes not processed)
|
//! \return the number of bytes that remain in the block (i.e., bytes not processed)
|
||||||
size_t PutWord16(word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true);
|
size_t PutWord16(word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true);
|
||||||
|
|
||||||
//! Input a 32-bit word for processing.
|
//! Input a 32-bit word for processing.
|
||||||
//! \param value the 32-bit value to be processed.
|
//! \param value the 32-bit value to be processed.
|
||||||
//! \param order the ByteOrder in which the word should be processed.
|
//! \param order the ByteOrder in which the word should be processed.
|
||||||
|
|
@ -1491,7 +1491,7 @@ public:
|
||||||
|
|
||||||
//! \name SIGNALS
|
//! \name SIGNALS
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
//! \brief Initialize or reinitialize this object, without signal propagation
|
//! \brief Initialize or reinitialize this object, without signal propagation
|
||||||
//! \param parameters a set of NameValuePairs to initialize this object
|
//! \param parameters a set of NameValuePairs to initialize this object
|
||||||
//! \throws NotImplemented
|
//! \throws NotImplemented
|
||||||
|
|
@ -1506,13 +1506,13 @@ public:
|
||||||
CRYPTOPP_UNUSED(parameters);
|
CRYPTOPP_UNUSED(parameters);
|
||||||
throw NotImplemented("BufferedTransformation: this object can't be reinitialized");
|
throw NotImplemented("BufferedTransformation: this object can't be reinitialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Flushes data buffered by this object, without signal propagation
|
//! \brief Flushes data buffered by this object, without signal propagation
|
||||||
//! \param hardFlush indicates whether all data should be flushed
|
//! \param hardFlush indicates whether all data should be flushed
|
||||||
//! \param blocking specifies whether the object should block when processing input
|
//! \param blocking specifies whether the object should block when processing input
|
||||||
//! \note hardFlush must be used with care
|
//! \note hardFlush must be used with care
|
||||||
virtual bool IsolatedFlush(bool hardFlush, bool blocking) =0;
|
virtual bool IsolatedFlush(bool hardFlush, bool blocking) =0;
|
||||||
|
|
||||||
//! \brief Marks the end of a series of messages, without signal propagation
|
//! \brief Marks the end of a series of messages, without signal propagation
|
||||||
//! \param blocking specifies whether the object should block when completing the processing on
|
//! \param blocking specifies whether the object should block when completing the processing on
|
||||||
//! the current series of messages
|
//! the current series of messages
|
||||||
|
|
@ -1522,7 +1522,7 @@ public:
|
||||||
//! \brief Initialize or reinitialize this object, with signal propagation
|
//! \brief Initialize or reinitialize this object, with signal propagation
|
||||||
//! \param parameters a set of NameValuePairs to initialize or reinitialize this object
|
//! \param parameters a set of NameValuePairs to initialize or reinitialize this object
|
||||||
//! \param propagation the number of attached transformations the Initialize() signal should be passed
|
//! \param propagation the number of attached transformations the Initialize() signal should be passed
|
||||||
//! \details Initialize() is used to initialize or reinitialize an object using a variable number of
|
//! \details Initialize() is used to initialize or reinitialize an object using a variable number of
|
||||||
//! arbitrarily typed arguments. The function avoids the need for multiple constuctors providing
|
//! arbitrarily typed arguments. The function avoids the need for multiple constuctors providing
|
||||||
//! all possible combintations of configurable parameters.
|
//! all possible combintations of configurable parameters.
|
||||||
//! \details propagation count includes this object. Setting propagation to <tt>1</tt> means this
|
//! \details propagation count includes this object. Setting propagation to <tt>1</tt> means this
|
||||||
|
|
@ -1556,7 +1556,7 @@ public:
|
||||||
virtual bool MessageSeriesEnd(int propagation=-1, bool blocking=true);
|
virtual bool MessageSeriesEnd(int propagation=-1, bool blocking=true);
|
||||||
|
|
||||||
//! \brief Set propagation of automatically generated and transferred signals
|
//! \brief Set propagation of automatically generated and transferred signals
|
||||||
//! \param propagation then new value
|
//! \param propagation then new value
|
||||||
//! \details Setting propagation to <tt>0</tt> means do not automaticly generate signals. Setting
|
//! \details Setting propagation to <tt>0</tt> means do not automaticly generate signals. Setting
|
||||||
//! propagation to <tt>-1</tt> means unlimited propagation.
|
//! propagation to <tt>-1</tt> means unlimited propagation.
|
||||||
virtual void SetAutoSignalPropagation(int propagation)
|
virtual void SetAutoSignalPropagation(int propagation)
|
||||||
|
|
@ -1591,7 +1591,7 @@ public:
|
||||||
//! \return the number of bytes consumed during the call.
|
//! \return the number of bytes consumed during the call.
|
||||||
//! \details Use the return value of Get to detect short reads.
|
//! \details Use the return value of Get to detect short reads.
|
||||||
virtual size_t Get(byte &outByte);
|
virtual size_t Get(byte &outByte);
|
||||||
|
|
||||||
//! \brief Retrieve a block of bytes
|
//! \brief Retrieve a block of bytes
|
||||||
//! \param outString a block of bytes
|
//! \param outString a block of bytes
|
||||||
//! \param getMax the number of bytes to Get
|
//! \param getMax the number of bytes to Get
|
||||||
|
|
@ -1605,7 +1605,7 @@ public:
|
||||||
//! \details Peek does not remove bytes from the object. Use the return value of
|
//! \details Peek does not remove bytes from the object. Use the return value of
|
||||||
//! Get to detect short reads.
|
//! Get to detect short reads.
|
||||||
virtual size_t Peek(byte &outByte) const;
|
virtual size_t Peek(byte &outByte) const;
|
||||||
|
|
||||||
//! \brief Peek a block of bytes
|
//! \brief Peek a block of bytes
|
||||||
//! \param outString a block of bytes
|
//! \param outString a block of bytes
|
||||||
//! \param peekMax the number of bytes to Peek
|
//! \param peekMax the number of bytes to Peek
|
||||||
|
|
@ -1645,7 +1645,7 @@ public:
|
||||||
size_t PeekWord32(word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const;
|
size_t PeekWord32(word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const;
|
||||||
|
|
||||||
//! move transferMax bytes of the buffered output to target as input
|
//! move transferMax bytes of the buffered output to target as input
|
||||||
|
|
||||||
//! \brief Transfer bytes from this object to another BufferedTransformation
|
//! \brief Transfer bytes from this object to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param transferMax the number of bytes to transfer
|
//! \param transferMax the number of bytes to transfer
|
||||||
|
|
@ -1656,13 +1656,20 @@ public:
|
||||||
lword TransferTo(BufferedTransformation &target, lword transferMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL)
|
lword TransferTo(BufferedTransformation &target, lword transferMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL)
|
||||||
{TransferTo2(target, transferMax, channel); return transferMax;}
|
{TransferTo2(target, transferMax, channel); return transferMax;}
|
||||||
|
|
||||||
//! \brief Discard skipMax bytes from the output buffer
|
//! \brief Discard skipMax bytes from the output buffer
|
||||||
//! \param skipMax the number of bytes to discard
|
//! \param skipMax the number of bytes to discard
|
||||||
//! \details Skip always returns skipMax.
|
//! \details Skip() discards bytes from the output buffer, which is the AttachedTransformation(), if present.
|
||||||
|
//! The function always returns skipMax.
|
||||||
|
//! \details If you want to skip bytes from a Source, then perform the following.
|
||||||
|
//! <pre>StringSource ss(str, false, new Redirector(TheBitBucket()));
|
||||||
|
//! ss.Pump(10); // Skip 10 bytes from Source
|
||||||
|
//! ss.Detach(new FilterChain(...));
|
||||||
|
//! ss.PumpAll();
|
||||||
|
//! </pre>
|
||||||
virtual lword Skip(lword skipMax=LWORD_MAX);
|
virtual lword Skip(lword skipMax=LWORD_MAX);
|
||||||
|
|
||||||
//! copy copyMax bytes of the buffered output to target as input
|
//! copy copyMax bytes of the buffered output to target as input
|
||||||
|
|
||||||
//! \brief Copy bytes from this object to another BufferedTransformation
|
//! \brief Copy bytes from this object to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param copyMax the number of bytes to copy
|
//! \param copyMax the number of bytes to copy
|
||||||
|
|
@ -1672,7 +1679,7 @@ public:
|
||||||
//! \details The function always returns copyMax. If an accurate count is needed, then use CopyRangeTo2.
|
//! \details The function always returns copyMax. If an accurate count is needed, then use CopyRangeTo2.
|
||||||
lword CopyTo(BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
|
lword CopyTo(BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
|
||||||
{return CopyRangeTo(target, 0, copyMax, channel);}
|
{return CopyRangeTo(target, 0, copyMax, channel);}
|
||||||
|
|
||||||
//! \brief Copy bytes from this object using an index to another BufferedTransformation
|
//! \brief Copy bytes from this object using an index to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param position the 0-based index of the byte stream to begin the copying
|
//! \param position the 0-based index of the byte stream to begin the copying
|
||||||
|
|
@ -1777,10 +1784,10 @@ public:
|
||||||
|
|
||||||
//! \name NON-BLOCKING TRANSFER OF OUTPUT
|
//! \name NON-BLOCKING TRANSFER OF OUTPUT
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
// upon return, byteCount contains number of bytes that have finished being transfered,
|
// upon return, byteCount contains number of bytes that have finished being transfered,
|
||||||
// and returns the number of bytes left in the current transfer block
|
// and returns the number of bytes left in the current transfer block
|
||||||
|
|
||||||
//! \brief Transfer bytes from this object to another BufferedTransformation
|
//! \brief Transfer bytes from this object to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param byteCount the number of bytes to transfer
|
//! \param byteCount the number of bytes to transfer
|
||||||
|
|
@ -1794,10 +1801,10 @@ public:
|
||||||
//! byteCount is the requested size of the transfer. When the call returns, byteCount is
|
//! byteCount is the requested size of the transfer. When the call returns, byteCount is
|
||||||
//! the number of bytes that were transferred.
|
//! the number of bytes that were transferred.
|
||||||
virtual size_t TransferTo2(BufferedTransformation &target, lword &byteCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) =0;
|
virtual size_t TransferTo2(BufferedTransformation &target, lword &byteCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) =0;
|
||||||
|
|
||||||
// upon return, begin contains the start position of data yet to be finished copying,
|
// upon return, begin contains the start position of data yet to be finished copying,
|
||||||
// and returns the number of bytes left in the current transfer block
|
// and returns the number of bytes left in the current transfer block
|
||||||
|
|
||||||
//! \brief Copy bytes from this object to another BufferedTransformation
|
//! \brief Copy bytes from this object to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param begin the 0-based index of the first byte to copy in the stream
|
//! \param begin the 0-based index of the first byte to copy in the stream
|
||||||
|
|
@ -1813,7 +1820,7 @@ public:
|
||||||
//! byte that was \a not copied (which may be different tahn end). begin can be used for
|
//! byte that was \a not copied (which may be different tahn end). begin can be used for
|
||||||
//! subsequent calls to CopyRangeTo2.
|
//! subsequent calls to CopyRangeTo2.
|
||||||
virtual size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const =0;
|
virtual size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const =0;
|
||||||
|
|
||||||
// upon return, messageCount contains number of messages that have finished being transfered,
|
// upon return, messageCount contains number of messages that have finished being transfered,
|
||||||
// and returns the number of bytes left in the current transfer block
|
// and returns the number of bytes left in the current transfer block
|
||||||
|
|
||||||
|
|
@ -1828,9 +1835,9 @@ public:
|
||||||
//! the number of messages requested to be transferred. When the call returns, messageCount is the
|
//! the number of messages requested to be transferred. When the call returns, messageCount is the
|
||||||
//! number of messages actually transferred.
|
//! number of messages actually transferred.
|
||||||
size_t TransferMessagesTo2(BufferedTransformation &target, unsigned int &messageCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true);
|
size_t TransferMessagesTo2(BufferedTransformation &target, unsigned int &messageCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true);
|
||||||
|
|
||||||
// returns the number of bytes left in the current transfer block
|
// returns the number of bytes left in the current transfer block
|
||||||
|
|
||||||
//! \brief Transfer all bytes from this object to another BufferedTransformation
|
//! \brief Transfer all bytes from this object to another BufferedTransformation
|
||||||
//! \param target the destination BufferedTransformation
|
//! \param target the destination BufferedTransformation
|
||||||
//! \param channel the channel on which the transfer should occur
|
//! \param channel the channel on which the transfer should occur
|
||||||
|
|
@ -1886,7 +1893,7 @@ public:
|
||||||
//! \return 0 indicates all bytes were processed during the call. Non-0 indicates the
|
//! \return 0 indicates all bytes were processed during the call. Non-0 indicates the
|
||||||
//! number of bytes that were \a not processed.
|
//! number of bytes that were \a not processed.
|
||||||
size_t ChannelPutWord16(const std::string &channel, word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true);
|
size_t ChannelPutWord16(const std::string &channel, word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true);
|
||||||
|
|
||||||
//! \brief Input a 32-bit word for processing on a channel.
|
//! \brief Input a 32-bit word for processing on a channel.
|
||||||
//! \param channel the channel to process the data.
|
//! \param channel the channel to process the data.
|
||||||
//! \param value the 32-bit value to be processed.
|
//! \param value the 32-bit value to be processed.
|
||||||
|
|
@ -1906,7 +1913,7 @@ public:
|
||||||
//! object only. Setting propagation to <tt>-1</tt> means unlimited propagation.
|
//! object only. Setting propagation to <tt>-1</tt> means unlimited propagation.
|
||||||
bool ChannelMessageEnd(const std::string &channel, int propagation=-1, bool blocking=true)
|
bool ChannelMessageEnd(const std::string &channel, int propagation=-1, bool blocking=true)
|
||||||
{return !!ChannelPut2(channel, NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);}
|
{return !!ChannelPut2(channel, NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);}
|
||||||
|
|
||||||
//! \brief Input multiple bytes for processing and signal the end of a message
|
//! \brief Input multiple bytes for processing and signal the end of a message
|
||||||
//! \param channel the channel to process the data.
|
//! \param channel the channel to process the data.
|
||||||
//! \param inString the byte buffer to process
|
//! \param inString the byte buffer to process
|
||||||
|
|
@ -1940,7 +1947,7 @@ public:
|
||||||
//! \param blocking specifies whether the object should block when processing input.
|
//! \param blocking specifies whether the object should block when processing input.
|
||||||
//! \return the number of bytes that remain in the block (i.e., bytes not processed)
|
//! \return the number of bytes that remain in the block (i.e., bytes not processed)
|
||||||
virtual size_t ChannelPut2(const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking);
|
virtual size_t ChannelPut2(const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking);
|
||||||
|
|
||||||
//! \brief Input multiple bytes that may be modified by callee on a channel
|
//! \brief Input multiple bytes that may be modified by callee on a channel
|
||||||
//! \param channel the channel to process the data
|
//! \param channel the channel to process the data
|
||||||
//! \param inString the byte buffer to process
|
//! \param inString the byte buffer to process
|
||||||
|
|
@ -1987,13 +1994,13 @@ public:
|
||||||
//! \return true if the object allows an attachment, false otherwise
|
//! \return true if the object allows an attachment, false otherwise
|
||||||
//! \details Sources and Filters will returns true, while Sinks and other objects will return false.
|
//! \details Sources and Filters will returns true, while Sinks and other objects will return false.
|
||||||
virtual bool Attachable() {return false;}
|
virtual bool Attachable() {return false;}
|
||||||
|
|
||||||
//! \brief Returns the object immediately attached to this object
|
//! \brief Returns the object immediately attached to this object
|
||||||
//! \return the attached transformation
|
//! \return the attached transformation
|
||||||
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
|
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
|
||||||
//! version of AttachedTransformation() always returns NULL.
|
//! version of AttachedTransformation() always returns NULL.
|
||||||
virtual BufferedTransformation *AttachedTransformation() {assert(!Attachable()); return 0;}
|
virtual BufferedTransformation *AttachedTransformation() {assert(!Attachable()); return 0;}
|
||||||
|
|
||||||
//! \brief Returns the object immediately attached to this object
|
//! \brief Returns the object immediately attached to this object
|
||||||
//! \return the attached transformation
|
//! \return the attached transformation
|
||||||
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
|
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
|
||||||
|
|
@ -2011,7 +2018,7 @@ public:
|
||||||
CRYPTOPP_UNUSED(newAttachment); assert(!Attachable());
|
CRYPTOPP_UNUSED(newAttachment); assert(!Attachable());
|
||||||
throw NotImplemented("BufferedTransformation: this object is not attachable");
|
throw NotImplemented("BufferedTransformation: this object is not attachable");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Add newAttachment to the end of attachment chain
|
//! \brief Add newAttachment to the end of attachment chain
|
||||||
//! \param newAttachment the attachment to add to the end of the chain
|
//! \param newAttachment the attachment to add to the end of the chain
|
||||||
virtual void Attach(BufferedTransformation *newAttachment);
|
virtual void Attach(BufferedTransformation *newAttachment);
|
||||||
|
|
@ -2169,7 +2176,7 @@ public:
|
||||||
//! \brief Generate a random key or crypto parameters
|
//! \brief Generate a random key or crypto parameters
|
||||||
//! \param rng a RandomNumberGenerator to produce keying material
|
//! \param rng a RandomNumberGenerator to produce keying material
|
||||||
//! \param keySize the size of the key, in bits
|
//! \param keySize the size of the key, in bits
|
||||||
//! \throws KeyingErr if a key can't be generated or algorithm parameters are invalid
|
//! \throws KeyingErr if a key can't be generated or algorithm parameters are invalid
|
||||||
//! \details GenerateRandomWithKeySize calls GenerateRandom with a NameValuePairs
|
//! \details GenerateRandomWithKeySize calls GenerateRandom with a NameValuePairs
|
||||||
//! object with only "KeySize"
|
//! object with only "KeySize"
|
||||||
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize);
|
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize);
|
||||||
|
|
@ -2201,7 +2208,7 @@ public:
|
||||||
//! \brief Retrieves a reference to CryptoMaterial
|
//! \brief Retrieves a reference to CryptoMaterial
|
||||||
//! \return a reference to the crypto material
|
//! \return a reference to the crypto material
|
||||||
virtual CryptoMaterial & AccessMaterial() =0;
|
virtual CryptoMaterial & AccessMaterial() =0;
|
||||||
|
|
||||||
//! \brief Retrieves a reference to CryptoMaterial
|
//! \brief Retrieves a reference to CryptoMaterial
|
||||||
//! \return a const reference to the crypto material
|
//! \return a const reference to the crypto material
|
||||||
virtual const CryptoMaterial & GetMaterial() const =0;
|
virtual const CryptoMaterial & GetMaterial() const =0;
|
||||||
|
|
@ -2211,7 +2218,7 @@ public:
|
||||||
//! \deprecated for backwards compatibility, calls <tt>AccessMaterial().Load(bt)</tt>
|
//! \deprecated for backwards compatibility, calls <tt>AccessMaterial().Load(bt)</tt>
|
||||||
void BERDecode(BufferedTransformation &bt)
|
void BERDecode(BufferedTransformation &bt)
|
||||||
{AccessMaterial().Load(bt);}
|
{AccessMaterial().Load(bt);}
|
||||||
|
|
||||||
//! \brief Saves this object to a BufferedTransformation
|
//! \brief Saves this object to a BufferedTransformation
|
||||||
//! \param bt a BufferedTransformation object
|
//! \param bt a BufferedTransformation object
|
||||||
//! \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
|
//! \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
|
||||||
|
|
@ -2228,7 +2235,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VC60 workaround: no co-variant return type
|
// VC60 workaround: no co-variant return type
|
||||||
|
|
||||||
//! \brief Retrieves a reference to a Public Key
|
//! \brief Retrieves a reference to a Public Key
|
||||||
//! \return a reference to the public key
|
//! \return a reference to the public key
|
||||||
CryptoMaterial & AccessMaterial()
|
CryptoMaterial & AccessMaterial()
|
||||||
|
|
@ -2311,7 +2318,7 @@ public:
|
||||||
//! \details This function returns 0 if plaintextLength is not valid (too long).
|
//! \details This function returns 0 if plaintextLength is not valid (too long).
|
||||||
virtual size_t CiphertextLength(size_t plaintextLength) const =0;
|
virtual size_t CiphertextLength(size_t plaintextLength) const =0;
|
||||||
|
|
||||||
//! \brief Determines whether this object supports the use of a named parameter
|
//! \brief Determines whether this object supports the use of a named parameter
|
||||||
//! \param name the name of the parameter
|
//! \param name the name of the parameter
|
||||||
//! \return true if the parameter name is supported, false otherwise
|
//! \return true if the parameter name is supported, false otherwise
|
||||||
//! \details Some possible parameter names: EncodingParameters(), KeyDerivationParameters()
|
//! \details Some possible parameter names: EncodingParameters(), KeyDerivationParameters()
|
||||||
|
|
@ -2330,7 +2337,7 @@ public:
|
||||||
//! \details FixedMaxPlaintextLength(0 returns the maximum plaintext length given the fixed ciphertext
|
//! \details FixedMaxPlaintextLength(0 returns the maximum plaintext length given the fixed ciphertext
|
||||||
//! length, if one exists, otherwise return 0.
|
//! length, if one exists, otherwise return 0.
|
||||||
virtual size_t FixedMaxPlaintextLength() const {return 0;}
|
virtual size_t FixedMaxPlaintextLength() const {return 0;}
|
||||||
|
|
||||||
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
|
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
|
||||||
size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);}
|
size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);}
|
||||||
size_t CipherTextLength(size_t plainTextLength) const {return CiphertextLength(plainTextLength);}
|
size_t CipherTextLength(size_t plainTextLength) const {return CiphertextLength(plainTextLength);}
|
||||||
|
|
@ -2359,8 +2366,8 @@ public:
|
||||||
//! \pre <tt>COUNTOF(ciphertext) == CiphertextLength(plaintextLength)</tt> ensures the output
|
//! \pre <tt>COUNTOF(ciphertext) == CiphertextLength(plaintextLength)</tt> ensures the output
|
||||||
//! byte buffer is large enough.
|
//! byte buffer is large enough.
|
||||||
//! \sa PK_Decryptor
|
//! \sa PK_Decryptor
|
||||||
virtual void Encrypt(RandomNumberGenerator &rng,
|
virtual void Encrypt(RandomNumberGenerator &rng,
|
||||||
const byte *plaintext, size_t plaintextLength,
|
const byte *plaintext, size_t plaintextLength,
|
||||||
byte *ciphertext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0;
|
byte *ciphertext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0;
|
||||||
|
|
||||||
//! \brief Create a new encryption filter
|
//! \brief Create a new encryption filter
|
||||||
|
|
@ -2396,8 +2403,8 @@ public:
|
||||||
//! \pre <tt>COUNTOF(plaintext) == MaxPlaintextLength(ciphertextLength)</tt> ensures the output
|
//! \pre <tt>COUNTOF(plaintext) == MaxPlaintextLength(ciphertextLength)</tt> ensures the output
|
||||||
//! byte buffer is large enough
|
//! byte buffer is large enough
|
||||||
//! \sa PK_Encryptor
|
//! \sa PK_Encryptor
|
||||||
virtual DecodingResult Decrypt(RandomNumberGenerator &rng,
|
virtual DecodingResult Decrypt(RandomNumberGenerator &rng,
|
||||||
const byte *ciphertext, size_t ciphertextLength,
|
const byte *ciphertext, size_t ciphertextLength,
|
||||||
byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0;
|
byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0;
|
||||||
|
|
||||||
//! \brief Create a new decryption filter
|
//! \brief Create a new decryption filter
|
||||||
|
|
@ -2406,7 +2413,7 @@ public:
|
||||||
//! \param parameters a set of NameValuePairs to initialize this object
|
//! \param parameters a set of NameValuePairs to initialize this object
|
||||||
//! \return the newly created decryption filter
|
//! \return the newly created decryption filter
|
||||||
//! \note the caller is responsible for deleting the returned pointer
|
//! \note the caller is responsible for deleting the returned pointer
|
||||||
virtual BufferedTransformation * CreateDecryptionFilter(RandomNumberGenerator &rng,
|
virtual BufferedTransformation * CreateDecryptionFilter(RandomNumberGenerator &rng,
|
||||||
BufferedTransformation *attachment=NULL, const NameValuePairs ¶meters = g_nullNameValuePairs) const;
|
BufferedTransformation *attachment=NULL, const NameValuePairs ¶meters = g_nullNameValuePairs) const;
|
||||||
|
|
||||||
//! \brief Decrypt a fixed size ciphertext
|
//! \brief Decrypt a fixed size ciphertext
|
||||||
|
|
@ -2522,7 +2529,7 @@ public:
|
||||||
{throw NotImplemented("PK_MessageAccumulator: DigestSize() should not be called");}
|
{throw NotImplemented("PK_MessageAccumulator: DigestSize() should not be called");}
|
||||||
|
|
||||||
//! \warning TruncatedFinal() should not be called on PK_MessageAccumulator
|
//! \warning TruncatedFinal() should not be called on PK_MessageAccumulator
|
||||||
void TruncatedFinal(byte *digest, size_t digestSize)
|
void TruncatedFinal(byte *digest, size_t digestSize)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(digest); CRYPTOPP_UNUSED(digestSize);
|
CRYPTOPP_UNUSED(digest); CRYPTOPP_UNUSED(digestSize);
|
||||||
throw NotImplemented("PK_MessageAccumulator: TruncatedFinal() should not be called");
|
throw NotImplemented("PK_MessageAccumulator: TruncatedFinal() should not be called");
|
||||||
|
|
@ -2587,7 +2594,7 @@ public:
|
||||||
//! \param signature a block of bytes for the signature
|
//! \param signature a block of bytes for the signature
|
||||||
//! \return actual signature length
|
//! \return actual signature length
|
||||||
//! \pre <tt>COUNTOF(signature) == MaxSignatureLength(recoverableMessageLength)</tt>
|
//! \pre <tt>COUNTOF(signature) == MaxSignatureLength(recoverableMessageLength)</tt>
|
||||||
virtual size_t SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength,
|
virtual size_t SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength,
|
||||||
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const;
|
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2626,7 +2633,7 @@ public:
|
||||||
//! \brief Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator
|
//! \brief Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator
|
||||||
//! \param messageAccumulator a reference to a PK_MessageAccumulator derived class
|
//! \param messageAccumulator a reference to a PK_MessageAccumulator derived class
|
||||||
//! \return true if the signature is valid, false otherwise
|
//! \return true if the signature is valid, false otherwise
|
||||||
//! \details VerifyAndRestart() restarts the messageAccumulator
|
//! \details VerifyAndRestart() restarts the messageAccumulator
|
||||||
virtual bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const =0;
|
virtual bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const =0;
|
||||||
|
|
||||||
//! \brief Check whether input signature is a valid signature for input message
|
//! \brief Check whether input signature is a valid signature for input message
|
||||||
|
|
@ -2635,7 +2642,7 @@ public:
|
||||||
//! \param signature a pointer to the signature over the message
|
//! \param signature a pointer to the signature over the message
|
||||||
//! \param signatureLen the size of the signature
|
//! \param signatureLen the size of the signature
|
||||||
//! \return true if the signature is valid, false otherwise
|
//! \return true if the signature is valid, false otherwise
|
||||||
virtual bool VerifyMessage(const byte *message, size_t messageLen,
|
virtual bool VerifyMessage(const byte *message, size_t messageLen,
|
||||||
const byte *signature, size_t signatureLen) const;
|
const byte *signature, size_t signatureLen) const;
|
||||||
|
|
||||||
//! \brief Recover a message from its signature
|
//! \brief Recover a message from its signature
|
||||||
|
|
@ -2662,7 +2669,7 @@ public:
|
||||||
//! \param signatureLength the size of the signature
|
//! \param signatureLength the size of the signature
|
||||||
//! \return the result of the verification operation
|
//! \return the result of the verification operation
|
||||||
//! \pre <tt>COUNTOF(recoveredMessage) == MaxRecoverableLengthFromSignatureLength(signatureLength)</tt>
|
//! \pre <tt>COUNTOF(recoveredMessage) == MaxRecoverableLengthFromSignatureLength(signatureLength)</tt>
|
||||||
virtual DecodingResult RecoverMessage(byte *recoveredMessage,
|
virtual DecodingResult RecoverMessage(byte *recoveredMessage,
|
||||||
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
|
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
|
||||||
const byte *signature, size_t signatureLength) const;
|
const byte *signature, size_t signatureLength) const;
|
||||||
};
|
};
|
||||||
|
|
@ -2920,9 +2927,9 @@ public:
|
||||||
virtual ~PasswordAuthenticatedKeyAgreementSession() {}
|
virtual ~PasswordAuthenticatedKeyAgreementSession() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng,
|
void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng,
|
||||||
const byte *myId, unsigned int myIdLength,
|
const byte *myId, unsigned int myIdLength,
|
||||||
const byte *counterPartyId, unsigned int counterPartyIdLength,
|
const byte *counterPartyId, unsigned int counterPartyIdLength,
|
||||||
const byte *passwordOrVerifier, unsigned int passwordOrVerifierLength);
|
const byte *passwordOrVerifier, unsigned int passwordOrVerifierLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2950,7 +2957,7 @@ public:
|
||||||
//! \brief Exception thrown when an ASN.1 BER decoing error is encountered
|
//! \brief Exception thrown when an ASN.1 BER decoing error is encountered
|
||||||
class CRYPTOPP_DLL BERDecodeErr : public InvalidArgument
|
class CRYPTOPP_DLL BERDecodeErr : public InvalidArgument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BERDecodeErr() : InvalidArgument("BER decode error") {}
|
BERDecodeErr() : InvalidArgument("BER decode error") {}
|
||||||
BERDecodeErr(const std::string &s) : InvalidArgument(s) {}
|
BERDecodeErr(const std::string &s) : InvalidArgument(s) {}
|
||||||
};
|
};
|
||||||
|
|
@ -2963,17 +2970,17 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ASN1Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ASN1Object() {}
|
virtual ~ASN1Object() {}
|
||||||
|
|
||||||
//! \brief Decode this object from a BufferedTransformation
|
//! \brief Decode this object from a BufferedTransformation
|
||||||
//! \param bt BufferedTransformation object
|
//! \param bt BufferedTransformation object
|
||||||
//! \details Uses Basic Encoding Rules (BER)
|
//! \details Uses Basic Encoding Rules (BER)
|
||||||
virtual void BERDecode(BufferedTransformation &bt) =0;
|
virtual void BERDecode(BufferedTransformation &bt) =0;
|
||||||
|
|
||||||
//! \brief Encode this object into a BufferedTransformation
|
//! \brief Encode this object into a BufferedTransformation
|
||||||
//! \param bt BufferedTransformation object
|
//! \param bt BufferedTransformation object
|
||||||
//! \details Uses Distinguished Encoding Rules (DER)
|
//! \details Uses Distinguished Encoding Rules (DER)
|
||||||
virtual void DEREncode(BufferedTransformation &bt) const =0;
|
virtual void DEREncode(BufferedTransformation &bt) const =0;
|
||||||
|
|
||||||
//! \brief Encode this object into a BufferedTransformation
|
//! \brief Encode this object into a BufferedTransformation
|
||||||
//! \param bt BufferedTransformation object
|
//! \param bt BufferedTransformation object
|
||||||
//! \details Uses Basic Encoding Rules (BER).
|
//! \details Uses Basic Encoding Rules (BER).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue