Crypto++  8.2
Free C++ class library of cryptographic schemes
simple.h
Go to the documentation of this file.
1 // simple.h - originally written and placed in the public domain by Wei Dai
2 
3 /// \file simple.h
4 /// \brief Classes providing basic library services.
5 
6 #ifndef CRYPTOPP_SIMPLE_H
7 #define CRYPTOPP_SIMPLE_H
8 
9 #include "config.h"
10 
11 #if CRYPTOPP_MSC_VERSION
12 # pragma warning(push)
13 # pragma warning(disable: 4127 4189)
14 #endif
15 
16 #include "cryptlib.h"
17 #include "misc.h"
18 
19 NAMESPACE_BEGIN(CryptoPP)
20 
21 /// \brief Base class for identifying alogorithm
22 /// \tparam BASE base class from which to derive
23 /// \tparam DERIVED class which to clone
24 template <class DERIVED, class BASE>
25 class CRYPTOPP_NO_VTABLE ClonableImpl : public BASE
26 {
27 public:
28  /// \brief Create a copy of this object
29  /// \returns a copy of this object
30  /// \details The caller is responsible for freeing the object.
31  Clonable * Clone() const {return new DERIVED(*static_cast<const DERIVED *>(this));}
32 };
33 
34 /// \brief Base class information
35 /// \tparam BASE an Algorithm derived class
36 /// \tparam ALGORITHM_INFO an Algorithm derived class
37 /// \details AlgorithmImpl provides StaticAlgorithmName from the template parameter BASE
38 template <class BASE, class ALGORITHM_INFO=BASE>
39 class CRYPTOPP_NO_VTABLE AlgorithmImpl : public BASE
40 {
41 public:
42  /// \brief The algorithm name
43  /// \returns the algorithm name
44  /// \details StaticAlgorithmName returns the algorithm's name as a static member function.
45  /// The name is taken from information provided by BASE.
46  static std::string CRYPTOPP_API StaticAlgorithmName() {return ALGORITHM_INFO::StaticAlgorithmName();}
47  /// \brief The algorithm name
48  /// \returns the algorithm name
49  /// \details AlgorithmName returns the algorithm's name as a member function.
50  /// The name is is acquired by calling StaticAlgorithmName.
51  std::string AlgorithmName() const {return ALGORITHM_INFO::StaticAlgorithmName();}
52 };
53 
54 /// \brief Exception thrown when an invalid key length is encountered
55 class CRYPTOPP_DLL InvalidKeyLength : public InvalidArgument
56 {
57 public:
58  /// \brief Construct an InvalidKeyLength
59  /// \param algorithm the Algorithm associated with the exception
60  /// \param length the key size associated with the exception
61  explicit InvalidKeyLength(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid key length") {}
62 };
63 
64 /// \brief Exception thrown when an invalid number of rounds is encountered
65 class CRYPTOPP_DLL InvalidRounds : public InvalidArgument
66 {
67 public:
68  /// \brief Construct an InvalidRounds
69  /// \param algorithm the Algorithm associated with the exception
70  /// \param rounds the number of rounds associated with the exception
71  explicit InvalidRounds(const std::string &algorithm, unsigned int rounds) : InvalidArgument(algorithm + ": " + IntToString(rounds) + " is not a valid number of rounds") {}
72 };
73 
74 /// \brief Exception thrown when an invalid block size is encountered
75 class CRYPTOPP_DLL InvalidBlockSize : public InvalidArgument
76 {
77 public:
78  /// \brief Construct an InvalidBlockSize
79  /// \param algorithm the Algorithm associated with the exception
80  /// \param length the block size associated with the exception
81  explicit InvalidBlockSize(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid block size") {}
82 };
83 
84 /// \brief Exception thrown when an invalid derived key length is encountered
85 class CRYPTOPP_DLL InvalidDerivedKeyLength : public InvalidArgument
86 {
87 public:
88  /// \brief Construct an InvalidDerivedKeyLength
89  /// \param algorithm the Algorithm associated with the exception
90  /// \param length the size associated with the exception
91  explicit InvalidDerivedKeyLength(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid derived key length") {}
92 };
93 
94 /// \brief Exception thrown when an invalid personalization string length is encountered
95 class CRYPTOPP_DLL InvalidPersonalizationLength : public InvalidArgument
96 {
97 public:
98  /// \brief Construct an InvalidPersonalizationLength
99  /// \param algorithm the Algorithm associated with the exception
100  /// \param length the personalization size associated with the exception
101  explicit InvalidPersonalizationLength(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid salt length") {}
102 };
103 
104 /// \brief Exception thrown when an invalid salt length is encountered
105 class CRYPTOPP_DLL InvalidSaltLength : public InvalidArgument
106 {
107 public:
108  /// \brief Construct an InvalidSaltLength
109  /// \param algorithm the Algorithm associated with the exception
110  /// \param length the salt size associated with the exception
111  explicit InvalidSaltLength(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid salt length") {}
112 };
113 
114 // *****************************
115 
116 /// \brief Base class for bufferless filters
117 /// \tparam T the class or type
118 template <class T>
119 class CRYPTOPP_NO_VTABLE Bufferless : public T
120 {
121 public:
122  /// \brief Flushes data buffered by this object, without signal propagation
123  /// \param hardFlush indicates whether all data should be flushed
124  /// \param blocking specifies whether the object should block when processing input
125  /// \note hardFlush must be used with care
126  bool IsolatedFlush(bool hardFlush, bool blocking)
127  {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); return false;}
128 };
129 
130 /// \brief Base class for unflushable filters
131 /// \tparam T the class or type
132 template <class T>
133 class CRYPTOPP_NO_VTABLE Unflushable : public T
134 {
135 public:
136  /// \brief Flush buffered input and/or output, with signal propagation
137  /// \param completeFlush is used to indicate whether all data should be flushed
138  /// \param propagation the number of attached transformations the Flush()
139  /// signal should be passed
140  /// \param blocking specifies whether the object should block when processing
141  /// input
142  /// \details propagation count includes this object. Setting propagation to
143  /// <tt>1</tt> means this object only. Setting propagation to <tt>-1</tt>
144  /// means unlimited propagation.
145  /// \note Hard flushes must be used with care. It means try to process and
146  /// output everything, even if there may not be enough data to complete the
147  /// action. For example, hard flushing a HexDecoder would cause an error if
148  /// you do it after inputing an odd number of hex encoded characters.
149  /// \note For some types of filters, like ZlibDecompressor, hard flushes can
150  /// only be done at "synchronization points". These synchronization points
151  /// are positions in the data stream that are created by hard flushes on the
152  /// corresponding reverse filters, in this example ZlibCompressor. This is
153  /// useful when zlib compressed data is moved across a network in packets
154  /// and compression state is preserved across packets, as in the SSH2 protocol.
155  bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
156  {return ChannelFlush(DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
157 
158  /// \brief Flushes data buffered by this object, without signal propagation
159  /// \param hardFlush indicates whether all data should be flushed
160  /// \param blocking specifies whether the object should block when processing input
161  /// \note hardFlush must be used with care
162  bool IsolatedFlush(bool hardFlush, bool blocking)
163  {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); CRYPTOPP_ASSERT(false); return false;}
164 
165  /// \brief Flush buffered input and/or output on a channel
166  /// \param channel the channel to flush the data
167  /// \param hardFlush is used to indicate whether all data should be flushed
168  /// \param propagation the number of attached transformations the ChannelFlush()
169  /// signal should be passed
170  /// \param blocking specifies whether the object should block when processing input
171  /// \return true of the Flush was successful
172  /// \details propagation count includes this object. Setting propagation to
173  /// <tt>1</tt> means this object only. Setting propagation to <tt>-1</tt> means
174  /// unlimited propagation.
175  bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
176  {
177  if (hardFlush && !InputBufferIsEmpty())
178  throw CannotFlush("Unflushable<T>: this object has buffered input that cannot be flushed");
179  else
180  {
181  BufferedTransformation *attached = this->AttachedTransformation();
182  return attached && propagation ? attached->ChannelFlush(channel, hardFlush, propagation-1, blocking) : false;
183  }
184  }
185 
186 protected:
187  virtual bool InputBufferIsEmpty() const {return false;}
188 };
189 
190 /// \brief Base class for input rejecting filters
191 /// \tparam T the class or type
192 /// \details T should be a BufferedTransformation derived class
193 template <class T>
194 class CRYPTOPP_NO_VTABLE InputRejecting : public T
195 {
196 public:
198  {InputRejected() : NotImplemented("BufferedTransformation: this object doesn't allow input") {}};
199 
200  /// \name INPUT
201  //@{
202 
203  /// \brief Input a byte array for processing
204  /// \param inString the byte array to process
205  /// \param length the size of the string, in bytes
206  /// \param messageEnd means how many filters to signal MessageEnd() to, including this one
207  /// \param blocking specifies whether the object should block when processing input
208  /// \throws InputRejected
209  /// \returns the number of bytes that remain in the block (i.e., bytes not processed)
210  /// \details Internally, the default implementation throws InputRejected.
211  size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
212  {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking); throw InputRejected();}
213  //@}
214 
215  /// \name SIGNALS
216  //@{
217  bool IsolatedFlush(bool hardFlush, bool blocking)
218  {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); return false;}
219  bool IsolatedMessageSeriesEnd(bool blocking)
220  {CRYPTOPP_UNUSED(blocking); throw InputRejected();}
221  size_t ChannelPut2(const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking)
222  {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking); throw InputRejected();}
223  bool ChannelMessageSeriesEnd(const std::string& channel, int messageEnd, bool blocking)
224  {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking); throw InputRejected();}
225  //@}
226 };
227 
228 /// \brief Interface for custom flush signals propagation
229 /// \tparam T BufferedTransformation derived class
230 template <class T>
231 class CRYPTOPP_NO_VTABLE CustomFlushPropagation : public T
232 {
233 public:
234  /// \name SIGNALS
235  //@{
236 
237  /// \brief Flush buffered input and/or output, with signal propagation
238  /// \param hardFlush is used to indicate whether all data should be flushed
239  /// \param propagation the number of attached transformations the Flush() signal should be passed
240  /// \param blocking specifies whether the object should block when processing input
241  /// \details propagation count includes this object. Setting propagation to <tt>1</tt> means this
242  /// object only. Setting propagation to <tt>-1</tt> means unlimited propagation.
243  /// \note Hard flushes must be used with care. It means try to process and output everything, even if
244  /// there may not be enough data to complete the action. For example, hard flushing a HexDecoder
245  /// would cause an error if you do it after inputing an odd number of hex encoded characters.
246  /// \note For some types of filters, like ZlibDecompressor, hard flushes can only
247  /// be done at "synchronization points". These synchronization points are positions in the data
248  /// stream that are created by hard flushes on the corresponding reverse filters, in this
249  /// example ZlibCompressor. This is useful when zlib compressed data is moved across a
250  /// network in packets and compression state is preserved across packets, as in the SSH2 protocol.
251  virtual bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) =0;
252 
253  //@}
254 
255 private:
256  bool IsolatedFlush(bool hardFlush, bool blocking)
257  {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking); CRYPTOPP_ASSERT(false); return false;}
258 };
259 
260 /// \brief Interface for custom flush signals
261 /// \tparam T BufferedTransformation derived class
262 template <class T>
263 class CRYPTOPP_NO_VTABLE CustomSignalPropagation : public CustomFlushPropagation<T>
264 {
265 public:
266  /// \brief Initialize or reinitialize this object, with signal propagation
267  /// \param parameters a set of NameValuePairs to initialize or reinitialize this object
268  /// \param propagation the number of attached transformations the Initialize() signal should be passed
269  /// \details Initialize() is used to initialize or reinitialize an object using a variable number of
270  /// arbitrarily typed arguments. The function avoids the need for multiple constructors providing
271  /// all possible combintations of configurable parameters.
272  /// \details propagation count includes this object. Setting propagation to <tt>1</tt> means this
273  /// object only. Setting propagation to <tt>-1</tt> means unlimited propagation.
274  virtual void Initialize(const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1) =0;
275 
276 private:
277  void IsolatedInitialize(const NameValuePairs &parameters)
278  {CRYPTOPP_UNUSED(parameters); CRYPTOPP_ASSERT(false);}
279 };
280 
281 /// \brief Multiple channels support for custom signal processing
282 /// \tparam T the class or type
283 /// \details T should be a BufferedTransformation derived class
284 template <class T>
285 class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation<T>
286 {
287 public:
288  bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
289  {return this->ChannelFlush(DEFAULT_CHANNEL, hardFlush, propagation, blocking);}
290 
291  /// \brief Marks the end of a series of messages, with signal propagation
292  /// \param propagation the number of attached transformations the MessageSeriesEnd() signal should be passed
293  /// \param blocking specifies whether the object should block when processing input
294  /// \details Each object that receives the signal will perform its processing, decrement
295  /// propagation, and then pass the signal on to attached transformations if the value is not 0.
296  /// \details propagation count includes this object. Setting propagation to <tt>1</tt> means this
297  /// object only. Setting propagation to <tt>-1</tt> means unlimited propagation.
298  /// \note There should be a MessageEnd() immediately before MessageSeriesEnd().
299  bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
300  {return this->ChannelMessageSeriesEnd(DEFAULT_CHANNEL, propagation, blocking);}
301 
302  /// \brief Request space which can be written into by the caller
303  /// \param size the requested size of the buffer
304  /// \details The purpose of this method is to help avoid extra memory allocations.
305  /// \details size is an \a IN and \a OUT parameter and used as a hint. When the call is made,
306  /// size is the requested size of the buffer. When the call returns, size is the size of
307  /// the array returned to the caller.
308  /// \details The base class implementation sets size to 0 and returns NULL.
309  /// \note Some objects, like ArraySink, cannot create a space because its fixed. In the case of
310  /// an ArraySink, the pointer to the array is returned and the size is remaining size.
311  byte * CreatePutSpace(size_t &size)
312  {return this->ChannelCreatePutSpace(DEFAULT_CHANNEL, size);}
313 
314  /// \brief Input multiple bytes for processing
315  /// \param inString the byte buffer to process
316  /// \param length the size of the string, in bytes
317  /// \param messageEnd means how many filters to signal MessageEnd() to, including this one
318  /// \param blocking specifies whether the object should block when processing input
319  /// \details Derived classes must implement Put2().
320  size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
321  {return this->ChannelPut2(DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
322 
323  /// \brief Input multiple bytes that may be modified by callee.
324  /// \param inString the byte buffer to process.
325  /// \param length the size of the string, in bytes.
326  /// \param messageEnd means how many filters to signal MessageEnd() to, including this one.
327  /// \param blocking specifies whether the object should block when processing input.
328  /// \details Internally, PutModifiable2() calls Put2().
329  size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking)
330  {return this->ChannelPutModifiable2(DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
331 
332 // void ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1)
333 // {PropagateMessageSeriesEnd(propagation, channel);}
334  byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
335  {CRYPTOPP_UNUSED(channel); size = 0; return NULLPTR;}
336  bool ChannelPutModifiable(const std::string &channel, byte *inString, size_t length)
337  {this->ChannelPut(channel, inString, length); return false;}
338 
339  virtual size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) =0;
340  size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
341  {return ChannelPut2(channel, begin, length, messageEnd, blocking);}
342 
343  virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true) =0;
344 };
345 
346 /// \brief Provides auto signaling support
347 /// \tparam T BufferedTransformation derived class
348 template <class T>
349 class CRYPTOPP_NO_VTABLE AutoSignaling : public T
350 {
351 public:
352  /// \brief Construct an AutoSignaling
353  /// \param propagation the propagation count
354  AutoSignaling(int propagation=-1) : m_autoSignalPropagation(propagation) {}
355 
356  void SetAutoSignalPropagation(int propagation)
357  {m_autoSignalPropagation = propagation;}
358  int GetAutoSignalPropagation() const
359  {return m_autoSignalPropagation;}
360 
361 private:
362  int m_autoSignalPropagation;
363 };
364 
365 /// \brief Acts as a Source for pre-existing, static data
366 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Store : public AutoSignaling<InputRejecting<BufferedTransformation> >
367 {
368 public:
369  /// \brief Construct a Store
370  Store() : m_messageEnd(false) {}
371 
372  void IsolatedInitialize(const NameValuePairs &parameters)
373  {
374  m_messageEnd = false;
375  StoreInitialize(parameters);
376  }
377 
378  unsigned int NumberOfMessages() const {return m_messageEnd ? 0 : 1;}
379  bool GetNextMessage();
380  unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const;
381 
382 protected:
383  virtual void StoreInitialize(const NameValuePairs &parameters) =0;
384 
385  bool m_messageEnd;
386 };
387 
388 /// \brief Implementation of BufferedTransformation's attachment interface
389 /// \details Sink is a cornerstone of the Pipeline trinitiy. Data flows from
390 /// Sources, through Filters, and then terminates in Sinks. The difference
391 /// between a Source and Filter is a Source \a pumps data, while a Filter does
392 /// not. The difference between a Filter and a Sink is a Filter allows an
393 /// attached transformation, while a Sink does not.
394 /// \details A Sink doesnot produce any retrievable output.
395 /// \details See the discussion of BufferedTransformation in cryptlib.h for
396 /// more details.
397 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Sink : public BufferedTransformation
398 {
399 public:
400  size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
401  {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(transferBytes); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking); transferBytes = 0; return 0;}
402  size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
403  {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(begin); CRYPTOPP_UNUSED(end); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking); return 0;}
404 };
405 
406 /// \brief Acts as an input discarding Filter or Sink
407 /// \details The BitBucket discards all input and returns 0 to the caller
408 /// to indicate all data was processed.
409 class CRYPTOPP_DLL BitBucket : public Bufferless<Sink>
410 {
411 public:
412  std::string AlgorithmName() const {return "BitBucket";}
413  void IsolatedInitialize(const NameValuePairs &params)
414  {CRYPTOPP_UNUSED(params);}
415  size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
416  {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking); return 0;}
417 };
418 
419 NAMESPACE_END
420 
421 #if CRYPTOPP_MSC_VERSION
422 # pragma warning(pop)
423 #endif
424 
425 #endif
Clonable * Clone() const
Create a copy of this object.
Definition: simple.h:31
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Definition: simple.h:320
An invalid argument was detected.
Definition: cryptlib.h:202
bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output, with signal propagation.
Definition: simple.h:155
bool IsolatedFlush(bool hardFlush, bool blocking)
Flushes data buffered by this object, without signal propagation.
Definition: simple.h:126
Utility functions for the Crypto++ library.
Store()
Construct a Store.
Definition: simple.h:370
bool IsolatedFlush(bool hardFlush, bool blocking)
Flushes data buffered by this object, without signal propagation.
Definition: simple.h:162
InvalidDerivedKeyLength(const std::string &algorithm, size_t length)
Construct an InvalidDerivedKeyLength.
Definition: simple.h:91
InvalidPersonalizationLength(const std::string &algorithm, size_t length)
Construct an InvalidPersonalizationLength.
Definition: simple.h:101
Base class for identifying alogorithm.
Definition: simple.h:25
Exception thrown when an invalid key length is encountered.
Definition: simple.h:55
std::string AlgorithmName() const
The algorithm name.
Definition: simple.h:51
unsigned int NumberOfMessages() const
Provides the number of meesages processed by this object.
Definition: simple.h:378
Flush(true) was called but it can&#39;t completely flush its buffers.
Definition: cryptlib.h:242
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.
Definition: simple.h:288
void IsolatedInitialize(const NameValuePairs &params)
Initialize or reinitialize this object, without signal propagation.
Definition: simple.h:413
Library configuration file.
Acts as a Source for pre-existing, static data.
Definition: simple.h:366
Base class for input rejecting filters.
Definition: simple.h:194
virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output on a channel.
Definition: cryptlib.cpp:485
Interface for buffered transformations.
Definition: cryptlib.h:1631
Interface for cloning objects.
Definition: cryptlib.h:585
Interface for custom flush signals propagation.
Definition: simple.h:231
Exception thrown when an invalid salt length is encountered.
Definition: simple.h:105
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.
Definition: simple.h:402
Exception thrown when an invalid block size is encountered.
Definition: simple.h:75
void IsolatedInitialize(const NameValuePairs &parameters)
Initialize or reinitialize this object, without signal propagation.
Definition: simple.h:372
InvalidSaltLength(const std::string &algorithm, size_t length)
Construct an InvalidSaltLength.
Definition: simple.h:111
Exception thrown when an invalid personalization string length is encountered.
Definition: simple.h:95
static std::string CRYPTOPP_API StaticAlgorithmName()
The algorithm name.
Definition: simple.h:46
A method was called which was not implemented.
Definition: cryptlib.h:232
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
Definition: cryptlib.h:511
Exception thrown when an invalid number of rounds is encountered.
Definition: simple.h:65
InvalidKeyLength(const std::string &algorithm, size_t length)
Construct an InvalidKeyLength.
Definition: simple.h:61
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
Transfer bytes from this object to another BufferedTransformation.
Definition: simple.h:400
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
Definition: cryptlib.h:529
bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
Flush buffered input and/or output on a channel.
Definition: simple.h:175
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Definition: trap.h:69
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input a byte array for processing.
Definition: simple.h:211
size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes that may be modified by callee.
Definition: simple.h:329
Base class for unflushable filters.
Definition: simple.h:133
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Definition: simple.h:415
Implementation of BufferedTransformation&#39;s attachment interface.
Definition: simple.h:397
Provides auto signaling support.
Definition: simple.h:349
Exception thrown when an invalid derived key length is encountered.
Definition: simple.h:85
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
Definition: misc.h:699
byte * CreatePutSpace(size_t &size)
Request space which can be written into by the caller.
Definition: simple.h:311
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
Marks the end of a series of messages, with signal propagation.
Definition: simple.h:299
Acts as an input discarding Filter or Sink.
Definition: simple.h:409
Crypto++ library namespace.
std::string AlgorithmName() const
Provides the name of this algorithm.
Definition: simple.h:412
Multiple channels support for custom signal processing.
Definition: simple.h:285
Interface for custom flush signals.
Definition: simple.h:263
InvalidRounds(const std::string &algorithm, unsigned int rounds)
Construct an InvalidRounds.
Definition: simple.h:71
AutoSignaling(int propagation=-1)
Construct an AutoSignaling.
Definition: simple.h:354
InvalidBlockSize(const std::string &algorithm, size_t length)
Construct an InvalidBlockSize.
Definition: simple.h:81
Base class for bufferless filters.
Definition: simple.h:119
Interface for retrieving values given their names.
Definition: cryptlib.h:321
Base class information.
Definition: simple.h:39