6 #ifndef CRYPTOPP_SIMPLE_H 7 #define CRYPTOPP_SIMPLE_H 11 #if CRYPTOPP_MSC_VERSION 12 # pragma warning(push) 13 # pragma warning(disable: 4127 4189) 21 template <class DERIVED, class BASE>
29 Clonable *
Clone()
const {
return new DERIVED(*static_cast<const DERIVED *>(
this));}
37 template <
class BASE,
class ALGORITHM_INFO=BASE>
42 std::string
AlgorithmName()
const {
return ALGORITHM_INFO::StaticAlgorithmName();}
97 bool Flush(
bool completeFlush,
int propagation=-1,
bool blocking=
true)
98 {
return ChannelFlush(
DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
101 bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true)
103 if (hardFlush && !InputBufferIsEmpty())
104 throw CannotFlush(
"Unflushable<T>: this object has buffered input that cannot be flushed");
108 return attached && propagation ? attached->
ChannelFlush(channel, hardFlush, propagation-1, blocking) :
false;
138 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
148 size_t ChannelPut2(
const std::string &channel,
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
179 virtual bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
218 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
219 {
return this->ChannelFlush(
DEFAULT_CHANNEL, hardFlush, propagation, blocking);}
230 {
return this->ChannelMessageSeriesEnd(
DEFAULT_CHANNEL, propagation, blocking);}
250 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
251 {
return this->ChannelPut2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
260 {
return this->ChannelPutModifiable2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
267 {this->ChannelPut(channel, inString, length);
return false;}
269 virtual size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking) =0;
271 {
return ChannelPut2(channel, begin, length, messageEnd, blocking);}
273 virtual bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
288 {m_autoSignalPropagation = propagation;}
290 {
return m_autoSignalPropagation;}
307 m_messageEnd =
false;
308 StoreInitialize(parameters);
312 bool GetNextMessage();
351 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
357 #if CRYPTOPP_MSC_VERSION 358 # pragma warning(pop) size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
An invalid argument was detected.
bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
std::string AlgorithmName() const
bool IsolatedFlush(bool hardFlush, bool blocking)
Utility functions for the Crypto++ library.
Store()
Construct a Store.
bool IsolatedFlush(bool hardFlush, bool blocking)
InvalidPersonalizationLength(const std::string &algorithm, size_t length)
virtual bool InputBufferIsEmpty() const
Base class for identifying alogorithm.
Exception thrown when an invalid key length is encountered.
bool ChannelPutModifiable(const std::string &channel, byte *inString, size_t length)
#define NAMESPACE_BEGIN(x)
Flush(true) was called but it can't completely flush its buffers.
Abstract base classes that provide a uniform interface to this library.
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
void IsolatedInitialize(const NameValuePairs ¶ms)
Initialize or reinitialize this object, without signal propagation.
void IsolatedInitialize(const NameValuePairs ¶meters)
Library configuration file.
std::string AlgorithmName() const
Provides the name of this algorithm.
Acts as a Source for pre-existing, static data.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Interface for cloning objects.
Interface for custom flush signals propagation.
Exception thrown when an invalid salt length is encountered.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
InvalidSaltLength(const std::string &algorithm, size_t length)
Exception thrown when an invalid personalization string length is encountered.
static std::string CRYPTOPP_API StaticAlgorithmName()
void SetAutoSignalPropagation(int propagation)
A method was called which was not implemented.
Exception thrown when an invalid number of rounds is encountered.
int m_autoSignalPropagation
InvalidKeyLength(const std::string &algorithm, size_t length)
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
#define CRYPTOPP_ASSERT(exp)
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
#define CRYPTOPP_NO_VTABLE
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
Copy bytes from this object to another BufferedTransformation.
size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee.
Base class for unflushable filters.
uint8_t const size_t const size
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
#define CRYPTOPP_UNUSED(x)
Implementation of BufferedTransformation's attachment interface.
Provides auto signaling support.
int GetAutoSignalPropagation() const
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
std::vector< char * > parameters
Acts as an input discarding Filter or Sink.
bool IsolatedFlush(bool hardFlush, bool blocking)
size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
unsigned int NumberOfMessages() const
Provides the number of meesages processed by this object.
Multiple channels support for custom signal processing.
Interface for custom flush signals.
InvalidRounds(const std::string &algorithm, unsigned int rounds)
AutoSignaling(int propagation=-1)
Construct an AutoSignaling.
Base class for bufferless filters.
Interface for retrieving values given their names.
Base class for identifying alogorithm.