Updated documentation (Issue 248)

This commit is contained in:
Jeffrey Walton 2016-08-27 23:52:43 -04:00
parent 15ec4ef713
commit fcdc845bba
2 changed files with 95 additions and 88 deletions

View File

@ -184,7 +184,7 @@ size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const by
assert(inBlocks);
assert(outBlocks);
assert(length);
size_t blockSize = BlockSize();
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
size_t xorIncrement = xorBlocks ? blockSize : 0;
@ -262,7 +262,7 @@ void AuthenticatedSymmetricCipher::SpecifyDataLengths(lword headerLength, lword
if (messageLength > MaxMessageLength())
throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength()));
if (footerLength > 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,
// and GenerateBlock calls GenerateIntoBufferedTransformation. Ad infinitum. Also
// see https://github.com/weidai11/cryptopp/issues/38.
//
//
// 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
// builds to alert the programmer and throw in Release builds. Developers have
@ -369,7 +369,7 @@ public:
//! \brief The name of the generator
//! \returns the string \a NullRNGs
std::string AlgorithmName() const {return "NullRNG";}
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
//! \brief An implementation that throws NotImplemented
byte GenerateByte () {}
@ -397,7 +397,7 @@ public:
void DiscardBytes (size_t n) {}
//! \brief An implementation that does nothing
void Shuffle (IT begin, IT end) {}
private:
Clonable* Clone () const { return NULL; }
#endif
@ -801,7 +801,7 @@ public:
m_ciphertext.resize(ciphertextLength);
m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters);
}
FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd);
}
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);
}
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
{
member_ptr<PK_MessageAccumulator> m(NewSignatureAccumulator(rng));
@ -909,8 +909,8 @@ DecodingResult PK_Verifier::Recover(byte *recoveredMessage, PK_MessageAccumulato
return RecoverAndRestart(recoveredMessage, *m);
}
DecodingResult PK_Verifier::RecoverMessage(byte *recoveredMessage,
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
DecodingResult PK_Verifier::RecoverMessage(byte *recoveredMessage,
const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength,
const byte *signature, size_t signatureLength) const
{
member_ptr<PK_MessageAccumulator> m(NewVerificationAccumulator());

View File

@ -161,7 +161,7 @@ public:
//! \brief Construct a new Exception
explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {}
virtual ~Exception() throw() {}
//! \brief Retrieves a C-string describing the exception
const char *what() const throw() {return (m_what.c_str());}
//! \brief Retrieves a string describing the exception
@ -269,7 +269,7 @@ struct CRYPTOPP_DLL DecodingResult
//! and to read values from keys and crypto parameters.
//! \details To obtain an object that implements NameValuePairs for the purpose of parameter
//! 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.
//! 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
@ -296,7 +296,7 @@ public:
//! \brief Provides the stored type
//! \return the C++ mangled name of the type
const std::type_info & GetStoredTypeInfo() const {return m_stored;}
//! \brief Provides the retrieveing type
//! \return the C++ mangled name of the type
const std::type_info & GetRetrievingTypeInfo() const {return m_retrieving;}
@ -423,7 +423,7 @@ public:
if (!GetIntValue(name, value))
throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'");
}
//! \brief Get a named value
//! \param name the name of the object or value to retrieve
//! \param valueType reference to a variable that receives the value
@ -481,7 +481,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Clonable
{
public:
virtual ~Clonable() {}
//! \brief Copies this object
//! \return a copy of this object
//! \throws NotImplemented
@ -508,7 +508,7 @@ public:
//! 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.
Algorithm(bool checkSelfTestStatus = true);
//! \brief Provides the name of this algorithm
//! \return the standard algorithm name
//! \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>,
//! an IV of all 0's will be assumed.
bool IsResynchronizable() const {return IVRequirement() < NOT_RESYNCHRONIZABLE;}
//! \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
bool CanUseRandomIVs() const {return IVRequirement() <= UNPREDICTABLE_RANDOM_IV;}
//! \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
//! GetNextIV), false otherwise
bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;}
//! \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
//! GetNextIV), false otherwise
@ -634,12 +634,12 @@ public:
//! \brief Provides the default size of an IV
//! \return default length of IVs accepted by this object, in bytes
unsigned int DefaultIVLength() const {return IVSize();}
//! \brief Provides the minimum size of an IV
//! \return minimal length of IVs accepted by this object, in bytes
//! \throws NotImplemented() if the object does not support resynchronization
virtual unsigned int MinIVLength() const {return IVSize();}
//! \brief Provides the maximum size of an IV
//! \return maximal length of IVs accepted by this object, in bytes
//! \throws NotImplemented() if the object does not support resynchronization
@ -670,26 +670,26 @@ protected:
//! \brief Returns the base class Algorithm
//! \return the base class Algorithm
virtual const Algorithm & GetAlgorithm() const =0;
//! \brief Sets the key for this object without performing parameter validation
//! \param key a byte buffer used to key the cipher
//! \param length the length of the byte buffer
//! \param params additional parameters passed as NameValuePairs
//! \details key must be at least DEFAULT_KEYLENGTH in length.
virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params) =0;
//! \brief Validates the key length
//! \param length the size of the keying material, in bytes
//! \throws InvalidKeyLength if the key length is invalid
void ThrowIfInvalidKeyLength(size_t length);
//! \brief Validates the object
//! \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.
//! \note called when no IV is passed
void ThrowIfResynchronizable();
//! \brief Validates the IV
//! \param iv the IV with a length of IVSize, in bytes
//! \throws InvalidArgument on failure
@ -698,19 +698,19 @@ protected:
//! UNPREDICTABLE_RANDOM_IV. If IVRequirement is UNPREDICTABLE_RANDOM_IV, then
//! then the function succeeds. Otherwise, an exception is thrown.
void ThrowIfInvalidIV(const byte *iv);
//! \brief Validates the IV length
//! \param length the size of an IV, in bytes
//! \throws InvalidArgument if the number of rounds are invalid
size_t ThrowIfInvalidIVLength(int length);
//! \brief Retrieves and validates the IV
//! \param params NameValuePairs with the IV supplied as a ConstByteArrayParameter
//! \param size the length of the IV, in bytes
//! \return a pointer to the first byte of the IV
//! \throws InvalidArgument if the number of rounds are invalid
const byte * GetIVAndThrowIfInvalid(const NameValuePairs &params, size_t &size);
//! \brief Validates the key length
//! \param length the size of the keying material, in bytes
inline void AssertValidKeyLength(size_t length) const
@ -787,11 +787,11 @@ public:
BT_InBlockIsCounter=1,
//! \brief should not modify block pointers
BT_DontIncrementInOutPointers=2,
//! \brief
//! \brief
BT_XorInput=4,
//! \brief perform the transformation in reverse
BT_ReverseDirection=8,
//! \brief
//! \brief
BT_AllowParallel=16};
//! \brief Encrypt and xor multiple blocks using additional flags
@ -835,11 +835,11 @@ public:
//! \note Optimal input length is
//! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>.
virtual unsigned int OptimalBlockSize() const {return MandatoryBlockSize();}
//! \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
virtual unsigned int GetOptimalBlockSizeUsed() const {return 0;}
//! \brief Provides input and output data alignment for optimal performance.
//! \return the input data alignment that provides optimal performance
virtual unsigned int OptimalDataAlignment() const;
@ -901,7 +901,7 @@ public:
//! \brief Determines whether the cipher is self-inverting
//! \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).
virtual bool IsSelfInverting() const =0;
@ -967,7 +967,7 @@ public:
//! \return the tag size of the hash.
//! \details Same as DigestSize().
unsigned int TagSize() const {return DigestSize();}
//! \brief Provides the block size of the compression function
//! \return the block size of the compression function, in bytes
//! \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
//! \return the input data alignment that provides optimal performance
virtual unsigned int OptimalDataAlignment() const;
//! \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 input the additional input as a buffer
@ -996,7 +996,7 @@ public:
//! the output byte buffer is large enough for the digest.
virtual void CalculateDigest(byte *digest, const byte *input, size_t length)
{Update(input, length); Final(digest);}
//! \brief Verifies the hash of the current message
//! \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
@ -1146,7 +1146,7 @@ public:
//! This is the case for some schemes, such as CCM.
//! \sa SpecifyDataLengths()
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
//! \sa NeedsPrespecifiedDataLengths()
void SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength=0);
@ -1192,7 +1192,7 @@ public:
//! \brief Update RNG state with additional unpredictable values
//! \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
//! \details A generator may or may not accept additional entropy. Call CanIncorporateEntropy() to test for the
//! ability to use additional entropy.
@ -1281,7 +1281,7 @@ public:
//! \brief Random Number Generator that does not produce random numbers
//! \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
//! 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.
//! \sa ClassNullRNG, PK_SignatureScheme::IsProbabilistic()
CRYPTOPP_DLL RandomNumberGenerator & CRYPTOPP_API NullRNG();
@ -1393,7 +1393,7 @@ public:
//! \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)
size_t PutWord16(word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true);
//! Input a 32-bit word for processing.
//! \param value the 32-bit value to be processed.
//! \param order the ByteOrder in which the word should be processed.
@ -1491,7 +1491,7 @@ public:
//! \name SIGNALS
//@{
//! \brief Initialize or reinitialize this object, without signal propagation
//! \param parameters a set of NameValuePairs to initialize this object
//! \throws NotImplemented
@ -1506,13 +1506,13 @@ public:
CRYPTOPP_UNUSED(parameters);
throw NotImplemented("BufferedTransformation: this object can't be reinitialized");
}
//! \brief Flushes data buffered by this object, without signal propagation
//! \param hardFlush indicates whether all data should be flushed
//! \param blocking specifies whether the object should block when processing input
//! \note hardFlush must be used with care
virtual bool IsolatedFlush(bool hardFlush, bool blocking) =0;
//! \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
//! the current series of messages
@ -1522,7 +1522,7 @@ public:
//! \brief Initialize or reinitialize this object, with signal propagation
//! \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
//! \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
//! all possible combintations of configurable parameters.
//! \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);
//! \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
//! propagation to <tt>-1</tt> means unlimited propagation.
virtual void SetAutoSignalPropagation(int propagation)
@ -1591,7 +1591,7 @@ public:
//! \return the number of bytes consumed during the call.
//! \details Use the return value of Get to detect short reads.
virtual size_t Get(byte &outByte);
//! \brief Retrieve a block of bytes
//! \param outString a block of bytes
//! \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
//! Get to detect short reads.
virtual size_t Peek(byte &outByte) const;
//! \brief Peek a block of bytes
//! \param outString a block of bytes
//! \param peekMax the number of bytes to Peek
@ -1645,7 +1645,7 @@ public:
size_t PeekWord32(word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const;
//! move transferMax bytes of the buffered output to target as input
//! \brief Transfer bytes from this object to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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)
{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
//! \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);
//! copy copyMax bytes of the buffered output to target as input
//! \brief Copy bytes from this object to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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.
lword CopyTo(BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
{return CopyRangeTo(target, 0, copyMax, channel);}
//! \brief Copy bytes from this object using an index to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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
//@{
// upon return, byteCount contains number of bytes that have finished being transfered,
// and returns the number of bytes left in the current transfer block
//! \brief Transfer bytes from this object to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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
//! 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;
// 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
//! \brief Copy bytes from this object to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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
//! 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;
// upon return, messageCount contains number of messages that have finished being transfered,
// 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
//! number of messages actually transferred.
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
//! \brief Transfer all bytes from this object to another BufferedTransformation
//! \param target the destination BufferedTransformation
//! \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
//! 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);
//! \brief Input a 32-bit word for processing on a channel.
//! \param channel the channel to process the data.
//! \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.
bool ChannelMessageEnd(const std::string &channel, int propagation=-1, bool blocking=true)
{return !!ChannelPut2(channel, NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);}
//! \brief Input multiple bytes for processing and signal the end of a message
//! \param channel the channel to process the data.
//! \param inString the byte buffer to process
@ -1940,7 +1947,7 @@ public:
//! \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)
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
//! \param channel the channel to process the data
//! \param inString the byte buffer to process
@ -1987,13 +1994,13 @@ public:
//! \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.
virtual bool Attachable() {return false;}
//! \brief Returns the object immediately attached to this object
//! \return the attached transformation
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
//! version of AttachedTransformation() always returns NULL.
virtual BufferedTransformation *AttachedTransformation() {assert(!Attachable()); return 0;}
//! \brief Returns the object immediately attached to this object
//! \return the attached transformation
//! \details AttachedTransformation() returns NULL if there is no attachment. The non-const
@ -2011,7 +2018,7 @@ public:
CRYPTOPP_UNUSED(newAttachment); assert(!Attachable());
throw NotImplemented("BufferedTransformation: this object is not attachable");
}
//! \brief Add newAttachment to the end of attachment chain
//! \param newAttachment the attachment to add to the end of the chain
virtual void Attach(BufferedTransformation *newAttachment);
@ -2169,7 +2176,7 @@ public:
//! \brief Generate a random key or crypto parameters
//! \param rng a RandomNumberGenerator to produce keying material
//! \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
//! object with only "KeySize"
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize);
@ -2201,7 +2208,7 @@ public:
//! \brief Retrieves a reference to CryptoMaterial
//! \return a reference to the crypto material
virtual CryptoMaterial & AccessMaterial() =0;
//! \brief Retrieves a reference to CryptoMaterial
//! \return a const reference to the crypto material
virtual const CryptoMaterial & GetMaterial() const =0;
@ -2211,7 +2218,7 @@ public:
//! \deprecated for backwards compatibility, calls <tt>AccessMaterial().Load(bt)</tt>
void BERDecode(BufferedTransformation &bt)
{AccessMaterial().Load(bt);}
//! \brief Saves this object to a BufferedTransformation
//! \param bt a BufferedTransformation object
//! \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
@ -2228,7 +2235,7 @@ public:
#endif
// VC60 workaround: no co-variant return type
//! \brief Retrieves a reference to a Public Key
//! \return a reference to the public key
CryptoMaterial & AccessMaterial()
@ -2311,7 +2318,7 @@ public:
//! \details This function returns 0 if plaintextLength is not valid (too long).
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
//! \return true if the parameter name is supported, false otherwise
//! \details Some possible parameter names: EncodingParameters(), KeyDerivationParameters()
@ -2330,7 +2337,7 @@ public:
//! \details FixedMaxPlaintextLength(0 returns the maximum plaintext length given the fixed ciphertext
//! length, if one exists, otherwise return 0.
virtual size_t FixedMaxPlaintextLength() const {return 0;}
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);}
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
//! byte buffer is large enough.
//! \sa PK_Decryptor
virtual void Encrypt(RandomNumberGenerator &rng,
const byte *plaintext, size_t plaintextLength,
virtual void Encrypt(RandomNumberGenerator &rng,
const byte *plaintext, size_t plaintextLength,
byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const =0;
//! \brief Create a new encryption filter
@ -2396,8 +2403,8 @@ public:
//! \pre <tt>COUNTOF(plaintext) == MaxPlaintextLength(ciphertextLength)</tt> ensures the output
//! byte buffer is large enough
//! \sa PK_Encryptor
virtual DecodingResult Decrypt(RandomNumberGenerator &rng,
const byte *ciphertext, size_t ciphertextLength,
virtual DecodingResult Decrypt(RandomNumberGenerator &rng,
const byte *ciphertext, size_t ciphertextLength,
byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const =0;
//! \brief Create a new decryption filter
@ -2406,7 +2413,7 @@ public:
//! \param parameters a set of NameValuePairs to initialize this object
//! \return the newly created decryption filter
//! \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 &parameters = g_nullNameValuePairs) const;
//! \brief Decrypt a fixed size ciphertext
@ -2522,7 +2529,7 @@ public:
{throw NotImplemented("PK_MessageAccumulator: DigestSize() should not be called");}
//! \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);
throw NotImplemented("PK_MessageAccumulator: TruncatedFinal() should not be called");
@ -2587,7 +2594,7 @@ public:
//! \param signature a block of bytes for the signature
//! \return actual signature length
//! \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;
};
@ -2626,7 +2633,7 @@ public:
//! \brief Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator
//! \param messageAccumulator a reference to a PK_MessageAccumulator derived class
//! \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;
//! \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 signatureLen the size of the signature
//! \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;
//! \brief Recover a message from its signature
@ -2662,7 +2669,7 @@ public:
//! \param signatureLength the size of the signature
//! \return the result of the verification operation
//! \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 *signature, size_t signatureLength) const;
};
@ -2920,9 +2927,9 @@ public:
virtual ~PasswordAuthenticatedKeyAgreementSession() {}
#endif
void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng,
const byte *myId, unsigned int myIdLength,
const byte *counterPartyId, unsigned int counterPartyIdLength,
void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng,
const byte *myId, unsigned int myIdLength,
const byte *counterPartyId, unsigned int counterPartyIdLength,
const byte *passwordOrVerifier, unsigned int passwordOrVerifierLength);
};
@ -2950,7 +2957,7 @@ public:
//! \brief Exception thrown when an ASN.1 BER decoing error is encountered
class CRYPTOPP_DLL BERDecodeErr : public InvalidArgument
{
public:
public:
BERDecodeErr() : InvalidArgument("BER decode error") {}
BERDecodeErr(const std::string &s) : InvalidArgument(s) {}
};
@ -2963,17 +2970,17 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ASN1Object
{
public:
virtual ~ASN1Object() {}
//! \brief Decode this object from a BufferedTransformation
//! \param bt BufferedTransformation object
//! \details Uses Basic Encoding Rules (BER)
virtual void BERDecode(BufferedTransformation &bt) =0;
//! \brief Encode this object into a BufferedTransformation
//! \param bt BufferedTransformation object
//! \details Uses Distinguished Encoding Rules (DER)
virtual void DEREncode(BufferedTransformation &bt) const =0;
//! \brief Encode this object into a BufferedTransformation
//! \param bt BufferedTransformation object
//! \details Uses Basic Encoding Rules (BER).