6#ifndef CRYPTOPP_FILTERS_H
7#define CRYPTOPP_FILTERS_H
11#if CRYPTOPP_MSC_VERSION
13# pragma warning(disable: 4127 4189 4231 4275 4514)
83 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true);
90 void Insert(
Filter *nextFilter);
92 virtual bool ShouldPropagateMessageEnd()
const {
return true;}
93 virtual bool ShouldPropagateMessageSeriesEnd()
const {
return true;}
95 void PropagateInitialize(
const NameValuePairs ¶meters,
int propagation);
106 size_t Output(
int outputSite,
const byte *inString,
size_t length,
int messageEnd,
bool blocking,
const std::string &channel=
DEFAULT_CHANNEL);
117 size_t OutputModifiable(
int outputSite,
byte *inString,
size_t length,
int messageEnd,
bool blocking,
const std::string &channel=
DEFAULT_CHANNEL);
127 bool OutputMessageEnd(
int outputSite,
int propagation,
bool blocking,
const std::string &channel=
DEFAULT_CHANNEL);
146 bool OutputFlush(
int outputSite,
bool hardFlush,
int propagation,
bool blocking,
const std::string &channel=
DEFAULT_CHANNEL);
159 bool OutputMessageSeriesEnd(
int outputSite,
int propagation,
bool blocking,
const std::string &channel=
DEFAULT_CHANNEL);
165 size_t m_inputPosition;
190 if (m_tempSpace.size() < minSize)
193 if (desiredSize >= minSize)
195 bufferSize = desiredSize;
198 m_tempSpace.New(bufferSize);
201 bufferSize = m_tempSpace.size();
202 return m_tempSpace.begin();
213 {
return HelpCreatePutSpace(target, channel, minSize, minSize, minSize);}
223 {
return HelpCreatePutSpace(target, channel, minSize, minSize, bufferSize);}
243 : m_transparent(transparent), m_currentMessageBytes(0), m_totalBytes(0)
244 , m_currentSeriesMessages(0), m_totalMessages(0), m_totalMessageSeries(0)
245 , m_begin(NULLPTR), m_length(0) {Detach(attachment); ResetMeter();}
267 {CRYPTOPP_UNUSED(parameters); ResetMeter();}
290 byte *
CreatePutSpace(
size_t &size) {
return AttachedTransformation()->CreatePutSpace(size);}
291 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
292 size_t PutModifiable2(
byte *inString,
size_t length,
int messageEnd,
bool blocking);
296 size_t PutMaybeModifiable(
byte *inString,
size_t length,
int messageEnd,
bool blocking,
bool modifiable);
297 bool ShouldPropagateMessageEnd()
const {
return m_transparent;}
298 bool ShouldPropagateMessageSeriesEnd()
const {
return m_transparent;}
302 inline bool operator<(
const MessageRange &b)
const
303 {
return message < b.message || (message == b.message && position < b.position);}
304 unsigned int message;
lword position;
lword size;
308 lword m_currentMessageBytes, m_totalBytes;
309 unsigned int m_currentSeriesMessages, m_totalMessages, m_totalMessageSeries;
310 std::deque<MessageRange> m_rangesToSkip;
359 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
361 return PutMaybeModifiable(
const_cast<byte *
>(inString), length, messageEnd, blocking,
false);
364 size_t PutModifiable2(
byte *inString,
size_t length,
int messageEnd,
bool blocking)
366 return PutMaybeModifiable(inString, length, messageEnd, blocking,
true);
383 virtual bool DidFirstPut()
const {
return m_firstInputDone;}
384 virtual size_t GetFirstPutSize()
const {
return m_firstSize;}
385 virtual size_t GetBlockPutSize()
const {
return m_blockSize;}
386 virtual size_t GetLastPutSize()
const {
return m_lastSize;}
388 virtual void InitializeDerivedAndReturnNewSizes(
const NameValuePairs ¶meters,
size_t &firstSize,
size_t &blockSize,
size_t &lastSize)
389 {CRYPTOPP_UNUSED(parameters); CRYPTOPP_UNUSED(firstSize); CRYPTOPP_UNUSED(blockSize); CRYPTOPP_UNUSED(lastSize); InitializeDerived(parameters);}
391 {CRYPTOPP_UNUSED(parameters);}
395 virtual void FirstPut(
const byte *inString) =0;
397 virtual void NextPutSingle(
const byte *inString)
401 virtual void NextPutMultiple(
const byte *inString,
size_t length);
403 virtual void NextPutModifiable(
byte *inString,
size_t length)
404 {NextPutMultiple(inString, length);}
415 virtual void LastPut(
const byte *inString,
size_t length) =0;
416 virtual void FlushDerived() {}
419 size_t PutMaybeModifiable(
byte *begin,
size_t length,
int messageEnd,
bool blocking,
bool modifiable);
420 void NextPutMaybeModifiable(
byte *inString,
size_t length,
bool modifiable)
422 if (modifiable) NextPutModifiable(inString, length);
423 else NextPutMultiple(inString, length);
428 virtual int NextPut(
const byte *inString,
size_t length)
429 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length);
CRYPTOPP_ASSERT(
false);
return 0;}
434 void ResetQueue(
size_t blockSize,
size_t maxBlocks);
436 byte *GetContigousBlocks(
size_t &numberOfBytes);
437 size_t GetAll(
byte *outString);
438 void Put(
const byte *inString,
size_t length);
439 size_t CurrentSize()
const {
return m_size;}
440 size_t MaxSize()
const {
return m_buffer.size();}
444 size_t m_blockSize, m_maxBlocks, m_size;
448 size_t m_firstSize, m_blockSize, m_lastSize;
449 bool m_firstInputDone;
466 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
471 m_inQueue.Put(inString, length);
474 IsolatedMessageEnd(blocking);
475 Output(0, NULLPTR, 0, messageEnd, blocking);
481 virtual bool IsolatedMessageEnd(
bool blocking) =0;
483 {CRYPTOPP_UNUSED(parameters); m_inQueue.Clear();}
563 void InitializeDerivedAndReturnNewSizes(
const NameValuePairs ¶meters,
size_t &firstSize,
size_t &blockSize,
size_t &lastSize);
564 void FirstPut(
const byte *inString);
565 void NextPutMultiple(
const byte *inString,
size_t length);
566 void NextPutModifiable(
byte *inString,
size_t length);
567 void LastPut(
const byte *inString,
size_t length);
573 unsigned int m_mandatoryBlockSize;
574 unsigned int m_optimalBufferSize;
575 unsigned int m_reservedBufferSize;
597 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
598 byte *
CreatePutSpace(
size_t &size) {
return m_hashModule.CreateUpdateSpace(size);}
603 unsigned int m_digestSize;
605 std::string m_messagePutChannel, m_hashPutChannel;
620 :
Exception(DATA_INTEGRITY_CHECK_FAILED,
"HashVerificationFilter: message hash or MAC not valid") {}
640 DEFAULT_FLAGS = HASH_AT_BEGIN | PUT_RESULT
652 bool GetLastResult()
const {
return m_verified;}
655 void InitializeDerivedAndReturnNewSizes(
const NameValuePairs ¶meters,
size_t &firstSize,
size_t &blockSize,
size_t &lastSize);
656 void FirstPut(
const byte *inString);
657 void NextPutMultiple(
const byte *inString,
size_t length);
658 void LastPut(
const byte *inString,
size_t length);
665 unsigned int m_digestSize;
700 size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking);
712 void LastPut(
const byte *inString,
size_t length);
745 DEFAULT_FLAGS = THROW_EXCEPTION
763 size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking);
765 {
return ChannelPut2(channel, begin, length, messageEnd, blocking); }
771 void InitializeDerivedAndReturnNewSizes(
const NameValuePairs ¶meters,
size_t &firstSize,
size_t &blockSize,
size_t &lastSize);
772 void FirstPut(
const byte *inString);
773 void NextPutMultiple(
const byte *inString,
size_t length);
785 void LastPut(
const byte *inString,
size_t length);
804 : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {Detach(attachment);}
809 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
830 :
Exception(DATA_INTEGRITY_CHECK_FAILED,
"VerifierFilter: digital signature not valid") {}
840 SIGNATURE_AT_BEGIN=1,
850 DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT
868 void InitializeDerivedAndReturnNewSizes(
const NameValuePairs ¶meters,
size_t &firstSize,
size_t &blockSize,
size_t &lastSize);
869 void FirstPut(
const byte *inString);
870 void NextPutMultiple(
const byte *inString,
size_t length);
871 void LastPut(
const byte *inString,
size_t length);
895 PASS_WAIT_OBJECTS = 0x02,
898 PASS_EVERYTHING = PASS_SIGNALS | PASS_WAIT_OBJECTS
904 Redirector() : m_target(NULLPTR), m_behavior(PASS_EVERYTHING) {}
910 : m_target(&target), m_behavior(behavior) {}
929 void SetPassSignals(
bool pass) {
if (pass) m_behavior |= PASS_SIGNALS;
else m_behavior &= ~static_cast<word32>(PASS_SIGNALS); }
935 void SetPassWaitObjects(
bool pass) {
if (pass) m_behavior |= PASS_WAIT_OBJECTS;
else m_behavior &= ~static_cast<word32>(PASS_WAIT_OBJECTS); }
938 {
return m_target ? m_target->CanModifyInput() :
false;}
944 return m_target->CreatePutSpace(size);
951 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
952 {
return m_target ? m_target->Put2(inString, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;}
953 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
954 {
return m_target && GetPassSignals() ? m_target->Flush(hardFlush, propagation, blocking) :
false;}
956 {
return m_target && GetPassSignals() ? m_target->MessageSeriesEnd(propagation, blocking) :
false;}
961 return m_target->ChannelCreatePutSpace(channel, size);
968 size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking)
969 {
return m_target ? m_target->ChannelPut2(channel, begin, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;}
971 {
return m_target ? m_target->ChannelPutModifiable2(channel, begin, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;}
972 bool ChannelFlush(
const std::string &channel,
bool completeFlush,
int propagation=-1,
bool blocking=
true)
973 {
return m_target && GetPassSignals() ? m_target->ChannelFlush(channel, completeFlush, propagation, blocking) :
false;}
975 {
return m_target && GetPassSignals() ? m_target->ChannelMessageSeriesEnd(channel, propagation, blocking) :
false;}
978 {
return m_target && GetPassWaitObjects() ? m_target->GetMaxWaitObjectCount() : 0; }
980 {
if (m_target && GetPassWaitObjects()) m_target->GetWaitObjects(container, callStack); }
1008 {
return m_owner.AttachedTransformation()->CreatePutSpace(size);}
1009 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
1010 {
return m_owner.AttachedTransformation()->Put2(inString, length, m_passSignal ? messageEnd : 0, blocking);}
1012 {
return m_owner.AttachedTransformation()->PutModifiable2(begin, length, m_passSignal ? messageEnd : 0, blocking);}
1014 {
if (m_passSignal) m_owner.AttachedTransformation()->Initialize(parameters, propagation);}
1015 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
1016 {
return m_passSignal ? m_owner.AttachedTransformation()->Flush(hardFlush, propagation, blocking) :
false;}
1018 {
return m_passSignal ? m_owner.AttachedTransformation()->MessageSeriesEnd(propagation, blocking) :
false;}
1021 {
return m_owner.AttachedTransformation()->ChannelCreatePutSpace(channel, size);}
1022 size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking)
1023 {
return m_owner.AttachedTransformation()->ChannelPut2(channel, begin, length, m_passSignal ? messageEnd : 0, blocking);}
1025 {
return m_owner.AttachedTransformation()->ChannelPutModifiable2(channel, begin, length, m_passSignal ? messageEnd : 0, blocking);}
1026 bool ChannelFlush(
const std::string &channel,
bool completeFlush,
int propagation=-1,
bool blocking=
true)
1027 {
return m_passSignal ? m_owner.AttachedTransformation()->ChannelFlush(channel, completeFlush, propagation, blocking) :
false;}
1029 {
return m_passSignal ? m_owner.AttachedTransformation()->ChannelMessageSeriesEnd(channel, propagation, blocking) :
false;}
1055 void NextPutMultiple(
const byte *s,
size_t len);
1056 void NextPutModifiable(
byte *inString,
size_t length);
1073 void FirstPut(
const byte * inString)
1074 {CRYPTOPP_UNUSED(inString);}
1087 {CRYPTOPP_UNUSED(inString), CRYPTOPP_UNUSED(length); m_filter->MessageEnd();}
1128 typedef typename T::value_type value_type;
1137 {
if (!parameters.
GetValue(
"OutputStringPointer", m_output))
throw InvalidArgument(
"StringSink: OutputStringPointer not specified");}
1139 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
1141 CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
1144 typename T::size_type size = m_output->size();
1145 if (length < size && size + length > m_output->capacity())
1146 m_output->reserve(2*size);
1147 m_output->insert(m_output->end(), (
const value_type *)inString, (
const value_type *)inString+length);
1186 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
1208 : m_buf(NULLPTR), m_size(0), m_total(0) {IsolatedInitialize(parameters);}
1214 : m_buf(buf), m_size(size), m_total(0) {}
1226 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
1252 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
1282 CRYPTOPP_DLL
void StoreInitialize(
const NameValuePairs ¶meters);
1284 const byte *m_store;
1285 size_t m_length, m_count;
1296 : m_rng(NULLPTR), m_length(0), m_count(0) {}
1299 : m_rng(&rng), m_length(length), m_count(0) {}
1307 CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(begin); CRYPTOPP_UNUSED(end); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking);
1308 throw NotImplemented(
"RandomNumberStore: CopyRangeTo2() is not supported by this store");
1315 lword m_length, m_count;
1325 {CRYPTOPP_UNUSED(parameters);}
1367 {Pump2(pumpMax);
return pumpMax;}
1374 {PumpMessages2(count);
return count;}
1400 virtual size_t PumpMessages2(
unsigned int &messageCount,
bool blocking=
true) =0;
1416 void SourceInitialize(
bool pumpAll,
const NameValuePairs ¶meters)
1418 IsolatedInitialize(parameters);
1438 {m_store.IsolatedInitialize(parameters);}
1446 {
return !m_store.AnyRetrievable() && !m_store.AnyMessages();}
1448 {m_store.SetAutoSignalPropagation(propagation);}
1450 {
return m_store.GetAutoSignalPropagation();}
1520 {SourceInitialize(pumpAll,
MakeParameters(
"RandomNumberGeneratorPointer", &rng)(
"RandomNumberStoreSize", length));}
1525#if CRYPTOPP_MSC_VERSION
1526# pragma warning(pop)
Classes for working with NameValuePairs.
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
bool operator<(const OID &lhs, const OID &rhs)
Compare two OIDs for ordering.
Copy input to a memory buffer.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
ArraySink(byte *buf, size_t size)
Construct an ArraySink.
lword TotalPutLength()
Provides the number of bytes written to the Sink.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
ArraySink(const NameValuePairs ¶meters=g_nullNameValuePairs)
Construct an ArraySink.
size_t AvailableSize()
Provides the size remaining in the Sink.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Pointer-based implementation of the Source interface.
Xor input to a memory buffer.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
ArrayXorSink(byte *buf, size_t size)
Construct an ArrayXorSink.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
Filter wrapper for decrypting with AuthenticatedSymmetricCipher.
std::string AlgorithmName() const
Provides the name of this algorithm.
Flags
Flags controlling filter behavior.
AuthenticatedDecryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment=NULL, word32 flags=DEFAULT_FLAGS, int truncatedDigestSize=-1, BlockPaddingScheme padding=DEFAULT_PADDING)
Construct a AuthenticatedDecryptionFilter.
size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee on a channel.
bool GetLastResult() const
Get verifier result.
size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing on a channel.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Request space which can be written into by the caller.
Filter wrapper for encrypting with AuthenticatedSymmetricCipher.
size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing on a channel.
void LastPut(const byte *inString, size_t length)
Input the last block of data.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Request space which can be written into by the caller.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
AuthenticatedEncryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment=NULL, bool putAAD=false, int truncatedDigestSize=-1, const std::string &macChannel=DEFAULT_CHANNEL, BlockPaddingScheme padding=DEFAULT_PADDING)
Construct a AuthenticatedEncryptionFilter.
Interface for authenticated encryption modes of operation.
Base class for bufferless filters.
Data structure used to store byte strings.
Used to pass byte array input as part of a NameValuePairs object.
Interface for custom flush signals.
Base class for all exceptions thrown by the library.
Implementation of BufferedTransformation's attachment interface.
const BufferedTransformation * AttachedTransformation() const
Retrieve attached transformation.
void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1)
Initialize or reinitialize this object, with signal propagation.
Filter(BufferedTransformation *attachment=NULL)
Construct a Filter.
bool Attachable()
Determine if attachable.
void Detach(BufferedTransformation *newAttachment=NULL)
Replace an attached transformation.
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.
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
BufferedTransformation * AttachedTransformation()
Retrieve attached transformation.
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
Access a block of memory.
Filter wrapper for HashTransformation.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
HashFilter(HashTransformation &hm, BufferedTransformation *attachment=NULL, bool putMessage=false, int truncatedDigestSize=-1, const std::string &messagePutChannel=DEFAULT_CHANNEL, const std::string &hashPutChannel=DEFAULT_CHANNEL)
Construct a HashFilter.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
std::string AlgorithmName() const
Provides the name of this algorithm.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
Exception thrown when a data integrity check failure is encountered.
Filter wrapper for HashTransformation.
HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment=NULL, word32 flags=DEFAULT_FLAGS, int truncatedDigestSize=-1)
Construct a HashVerificationFilter.
Flags
Flags controlling filter behavior.
std::string AlgorithmName() const
Provides the name of this algorithm.
An invalid argument was detected.
Measure how many bytes and messages pass through the filter.
size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
unsigned int GetCurrentSeriesMessages() const
Message number in the series.
unsigned int GetTotalMessageSeries() const
Number of messages processed by the filter.
void AddRangeToSkip(unsigned int message, lword position, lword size, bool sortNow=true)
Adds a range to skip during processing.
void ResetMeter()
Resets the meter.
lword GetCurrentMessageBytes() const
Number of bytes in the current message.
MeterFilter(BufferedTransformation *attachment=NULL, bool transparent=true)
Construct a MeterFilter.
lword GetTotalBytes() const
Number of bytes processed by the filter.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
bool IsolatedMessageSeriesEnd(bool blocking)
Marks the end of a series of messages, without signal propagation.
void SetTransparent(bool transparent)
Set or change the transparent mode of this object.
unsigned int GetTotalMessages() const
Number of messages in the message series.
Interface for retrieving values given their names.
bool GetValue(const char *name, T &value) const
Get a named value.
Ensures an object is not copyable.
A method was called which was not implemented.
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 TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
lword MaxRetrievable() const
Provides the number of bytes ready for retrieval.
A non-transparent MeterFilter.
OpaqueFilter(BufferedTransformation *attachment=NULL)
Construct an OpaqueFilter.
Filter class that is a proxy for a sink.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Request space which can be written into by the caller.
size_t PutModifiable2(byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing on a channel.
void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1)
Initialize or reinitialize this object, with signal propagation.
OutputProxy(BufferedTransformation &owner, bool passSignal)
Construct an OutputProxy.
bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output on a channel.
size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee on a channel.
void SetPassSignal(bool passSignal)
Set passSignal flag.
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
bool GetPassSignal() const
Retrieve passSignal flag.
bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true)
Marks the end of a series of messages on a channel.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
Filter wrapper for PK_Decryptor.
PK_DecryptorFilter(RandomNumberGenerator &rng, const PK_Decryptor &decryptor, BufferedTransformation *attachment=NULL)
Construct a PK_DecryptorFilter.
Interface for public-key decryptors.
Filter wrapper for PK_Encryptor.
PK_EncryptorFilter(RandomNumberGenerator &rng, const PK_Encryptor &encryptor, BufferedTransformation *attachment=NULL)
Construct a PK_EncryptorFilter.
Interface for public-key encryptors.
Interface for public-key signers.
Interface for public-key signature verifiers.
Base class for Filter classes that are proxies for a chain of other filters.
ProxyFilter(BufferedTransformation *filter, size_t firstSize, size_t lastSize, BufferedTransformation *attachment)
Construct a ProxyFilter.
void SetFilter(Filter *filter)
Sets the OutputProxy filter.
bool IsolatedFlush(bool hardFlush, bool blocking)
Flushes data buffered by this object, without signal propagation.
Interface for random number generators.
Incorporates input into RNG as additional entropy.
RandomNumberSink()
Construct a RandomNumberSink.
RandomNumberSink(RandomNumberGenerator &rng)
Construct a RandomNumberSink.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
RNG-based implementation of Source interface.
RNG-based implementation of Source interface.
bool AnyRetrievable() const
Determines whether bytes are ready for retrieval.
lword MaxRetrievable() const
Provides the number of bytes ready for retrieval.
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
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.
Redirect input to another BufferedTransformation without owning it.
Redirector(BufferedTransformation &target, Behavior behavior=PASS_EVERYTHING)
Construct a Redirector.
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
Behavior
Controls signal propagation behavior.
bool CanModifyInput() const
Determines whether input can be modified by the callee.
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Request space which can be written into by the caller.
Behavior GetBehavior()
Retrieve signal propagation behavior.
void SetPassWaitObjects(bool pass)
Set signal propagation behavior.
unsigned int GetMaxWaitObjectCount() const
Retrieves the maximum number of waitable objects.
bool GetPassSignals() const
Retrieve signal propagation behavior.
bool GetPassWaitObjects() const
Retrieve signal propagation behavior.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
void SetPassSignals(bool pass)
Set signal propagation behavior.
void StopRedirection()
Stop redirecting input.
bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true)
Marks the end of a series of messages on a channel.
void Redirect(BufferedTransformation &target)
Redirect input to another BufferedTransformation.
bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output on a channel.
size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee on a channel.
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
Retrieves waitable objects.
void SetBehavior(Behavior behavior)
Set signal propagation behavior.
size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing on a channel.
Redirector()
Construct a Redirector.
void Initialize(const NameValuePairs ¶meters, int propagation)
Initialize or reinitialize this object, with signal propagation.
Exception thrown when an invalid signature is encountered.
Filter wrapper for PK_Verifier.
Flags
Flags controlling filter behavior.
SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment=NULL, word32 flags=DEFAULT_FLAGS)
Construct a SignatureVerificationFilter.
bool GetLastResult() const
Retrieves the result of the last verification.
std::string AlgorithmName() const
Provides the name of this algorithm.
Filter wrapper for PK_Signer.
SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment=NULL, bool putMessage=false)
Construct a SignerFilter.
std::string AlgorithmName() const
Provides the name of this algorithm.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
Proxy filter that doesn't modify the underlying filter's input or output.
SimpleProxyFilter(BufferedTransformation *filter, BufferedTransformation *attachment)
Construct a SimpleProxyFilter.
void LastPut(const byte *inString, size_t length)
Input the last block of data.
Implementation of BufferedTransformation's attachment interface.
unsigned int PumpMessages(unsigned int count=UINT_MAX)
Pump messages to attached transformation.
void PumpAll()
Pump all data to attached transformation.
virtual size_t PumpMessages2(unsigned int &messageCount, bool blocking=true)=0
Pump messages to attached transformation.
virtual bool SourceExhausted() const =0
Determines if the Source is exhausted.
Source(BufferedTransformation *attachment=NULL)
Construct a Source.
virtual size_t PumpAll2(bool blocking=true)
Pump all data to attached transformation.
virtual size_t Pump2(lword &byteCount, bool blocking=true)=0
Pump data to attached transformation.
lword Pump(lword pumpMax=...)
Pump data to attached transformation.
Transform a Store into a Source.
size_t Pump2(lword &byteCount, bool blocking=true)
Pump data to attached transformation.
size_t PumpMessages2(unsigned int &messageCount, bool blocking=true)
Pump messages to attached transformation.
SourceTemplate(BufferedTransformation *attachment)
Construct a SourceTemplate.
bool SourceExhausted() const
Determines if the Source is exhausted.
size_t PumpAll2(bool blocking=true)
Pump all data to attached transformation.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
int GetAutoSignalPropagation() const
Retrieve automatic signal propagation value.
void SetAutoSignalPropagation(int propagation)
Set propagation of automatically generated and transferred signals.
Acts as a Source for pre-existing, static data.
Append input to a string object.
Append input to a string object.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
StringSinkTemplate(T &output)
Construct a StringSinkTemplate.
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
String-based implementation of the Source interface.
StringSource(BufferedTransformation *attachment=NULL)
Construct a StringSource.
StringSource(const std::string &string, bool pumpAll, BufferedTransformation *attachment=NULL)
Construct a StringSource.
StringSource(const char *string, bool pumpAll, BufferedTransformation *attachment=NULL)
Construct a StringSource.
StringSource(const byte *string, size_t length, bool pumpAll, BufferedTransformation *attachment=NULL)
Construct a StringSource.
String-based implementation of Store interface.
CRYPTOPP_DLL 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.
StringStore(const byte *string, size_t length)
Construct a StringStore.
StringStore(const T &string)
Construct a StringStore.
StringStore(const char *string=NULL)
Construct a StringStore.
CRYPTOPP_DLL size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
A transparent MeterFilter.
TransparentFilter(BufferedTransformation *attachment=NULL)
Construct a TransparentFilter.
Base class for unflushable filters.
Append input to a std::vector<byte> object.
std::vector-based implementation of the Source interface
VectorSource(const std::vector< byte > &vec, bool pumpAll, BufferedTransformation *attachment=NULL)
Construct a VectorSource.
VectorSource(BufferedTransformation *attachment=NULL)
Construct a VectorSource.
Library configuration file.
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Instantiate templates in a dynamic library.
const lword LWORD_MAX
Large word type max value.
unsigned int word32
32-bit unsigned datatype
word64 lword
Large word type.
Abstract base classes that provide a uniform interface to this library.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
Utility functions for the Crypto++ library.
T1 SaturatingSubtract(const T1 &a, const T2 &b)
Performs a saturating subtract clamped at 0.
#define SIZE_MAX
The maximum value of a machine word.
Crypto++ library namespace.
const char * BlockPaddingScheme()
StreamTransformationFilter::BlockPaddingScheme.
Classes for an unlimited queue to store bytes.
Classes and functions for secure memory allocations.
Classes providing basic library services.
Classes for automatic resource management.
Padding schemes used for block ciphers.
BlockPaddingScheme
Padding schemes used for block ciphers.
@ DEFAULT_PADDING
Default padding scheme.
@ W3C_PADDING
W3C padding added to a block.
@ PKCS_PADDING
PKCS padding added to a block.
@ ONE_AND_ZEROS_PADDING
1 and 0's padding added to a block
@ NO_PADDING
No padding added to a block.
@ ZEROS_PADDING
0's padding added to a block
Create a working space in a BufferedTransformation.
byte * HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize, size_t bufferSize)
Create a working space in a BufferedTransformation.
byte * HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize, size_t desiredSize, size_t &bufferSize)
Create a working space in a BufferedTransformation.
SecByteBlock m_tempSpace
Temporary working space.
byte * HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize)
Create a working space in a BufferedTransformation.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.