Crypto++  5.6.5
Free C++ class library of cryptographic schemes
algparam.h
Go to the documentation of this file.
1 // algparam.h - originally written and placed in the public domain by Wei Dai
2 
3 /// \file
4 /// \headerfile algparam.h
5 /// \brief Classes for working with NameValuePairs
6 
7 
8 #ifndef CRYPTOPP_ALGPARAM_H
9 #define CRYPTOPP_ALGPARAM_H
10 
11 #include "config.h"
12 #include "cryptlib.h"
13 
14 #if CRYPTOPP_MSC_VERSION
15 # pragma warning(push)
16 # pragma warning(disable: 4231 4275)
17 # if (CRYPTOPP_MSC_VERSION >= 1400)
18 # pragma warning(disable: 6011 6386 28193)
19 # endif
20 #endif
21 
22 #include "smartptr.h"
23 #include "secblock.h"
24 #include "integer.h"
25 #include "misc.h"
26 
27 NAMESPACE_BEGIN(CryptoPP)
28 
29 /// \class ConstByteArrayParameter
30 /// \brief Used to pass byte array input as part of a NameValuePairs object
32 {
33 public:
34  /// \brief Construct a ConstByteArrayParameter
35  /// \param data a C-String
36  /// \param deepCopy flag indicating whether the data should be copied
37  /// \details The deepCopy option is used when the NameValuePairs object can't
38  /// keep a copy of the data available
39  ConstByteArrayParameter(const char *data = NULLPTR, bool deepCopy = false)
40  : m_deepCopy(false), m_data(NULLPTR), m_size(0)
41  {
42  Assign((const byte *)data, data ? strlen(data) : 0, deepCopy);
43  }
44 
45  /// \brief Construct a ConstByteArrayParameter
46  /// \param data a memory buffer
47  /// \param size the length of the memory buffer
48  /// \param deepCopy flag indicating whether the data should be copied
49  /// \details The deepCopy option is used when the NameValuePairs object can't
50  /// keep a copy of the data available
51  ConstByteArrayParameter(const byte *data, size_t size, bool deepCopy = false)
52  : m_deepCopy(false), m_data(NULLPTR), m_size(0)
53  {
54  Assign(data, size, deepCopy);
55  }
56 
57  /// \brief Construct a ConstByteArrayParameter
58  /// \tparam T a std::basic_string<char> class
59  /// \param string a std::basic_string<char> class
60  /// \param deepCopy flag indicating whether the data should be copied
61  /// \details The deepCopy option is used when the NameValuePairs object can't
62  /// keep a copy of the data available
63  template <class T> ConstByteArrayParameter(const T &string, bool deepCopy = false)
64  : m_deepCopy(false), m_data(NULLPTR), m_size(0)
65  {
66  CRYPTOPP_COMPILE_ASSERT(sizeof(typename T::value_type) == 1);
67  Assign((const byte *)string.data(), string.size(), deepCopy);
68  }
69 
70  /// \brief Assign contents from a memory buffer
71  /// \param data a memory buffer
72  /// \param size the length of the memory buffer
73  /// \param deepCopy flag indicating whether the data should be copied
74  /// \details The deepCopy option is used when the NameValuePairs object can't
75  /// keep a copy of the data available
76  void Assign(const byte *data, size_t size, bool deepCopy)
77  {
78  // This fires, which means: no data with a size, or data with no size.
79  // CRYPTOPP_ASSERT((data && size) || !(data || size));
80  if (deepCopy)
81  m_block.Assign(data, size);
82  else
83  {
84  m_data = data;
85  m_size = size;
86  }
87  m_deepCopy = deepCopy;
88  }
89 
90  /// \brief Pointer to the first byte in the memory block
91  const byte *begin() const {return m_deepCopy ? m_block.begin() : m_data;}
92  /// \brief Pointer beyond the last byte in the memory block
93  const byte *end() const {return m_deepCopy ? m_block.end() : m_data + m_size;}
94  /// \brief Length of the memory block
95  size_t size() const {return m_deepCopy ? m_block.size() : m_size;}
96 
97 private:
98  bool m_deepCopy;
99  const byte *m_data;
100  size_t m_size;
101  SecByteBlock m_block;
102 };
103 
104 /// \class ByteArrayParameter
105 /// \brief Used to pass byte array input as part of a NameValuePairs object
107 {
108 public:
109  /// \brief Construct a ByteArrayParameter
110  /// \param data a memory buffer
111  /// \param size the length of the memory buffer
112  ByteArrayParameter(byte *data = NULLPTR, unsigned int size = 0)
113  : m_data(data), m_size(size) {}
114 
115  /// \brief Construct a ByteArrayParameter
116  /// \param block a SecByteBlock
118  : m_data(block.begin()), m_size(block.size()) {}
119 
120  /// \brief Pointer to the first byte in the memory block
121  byte *begin() const {return m_data;}
122  /// \brief Pointer beyond the last byte in the memory block
123  byte *end() const {return m_data + m_size;}
124  /// \brief Length of the memory block
125  size_t size() const {return m_size;}
126 
127 private:
128  byte *m_data;
129  size_t m_size;
130 };
131 
132 /// \class CombinedNameValuePairs
133 /// \brief Combines two sets of NameValuePairs
134 /// \details CombinedNameValuePairs allows you to provide two sets of of NameValuePairs.
135 /// If a name is not found in the first set, then the second set is searched for the
136 /// name and value pair. The second set of NameValuePairs often provides default values.
137 class CRYPTOPP_DLL CombinedNameValuePairs : public NameValuePairs
138 {
139 public:
140  /// \brief Construct a CombinedNameValuePairs
141  /// \param pairs1 reference to the first set of NameValuePairs
142  /// \param pairs2 reference to the second set of NameValuePairs
144  : m_pairs1(pairs1), m_pairs2(pairs2) {}
145 
146  bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const;
147 
148 private:
149  const NameValuePairs &m_pairs1, &m_pairs2;
150 };
151 
152 #ifndef CRYPTOPP_DOXYGEN_PROCESSING
153 template <class T, class BASE>
154 class GetValueHelperClass
155 {
156 public:
157  GetValueHelperClass(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst)
158  : m_pObject(pObject), m_name(name), m_valueType(&valueType), m_pValue(pValue), m_found(false), m_getValueNames(false)
159  {
160  if (strcmp(m_name, "ValueNames") == 0)
161  {
162  m_found = m_getValueNames = true;
163  NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(std::string), *m_valueType);
164  if (searchFirst)
165  searchFirst->GetVoidValue(m_name, valueType, pValue);
166  if (typeid(T) != typeid(BASE))
167  pObject->BASE::GetVoidValue(m_name, valueType, pValue);
168  ((*reinterpret_cast<std::string *>(m_pValue) += "ThisPointer:") += typeid(T).name()) += ';';
169  }
170 
171  if (!m_found && strncmp(m_name, "ThisPointer:", 12) == 0 && strcmp(m_name+12, typeid(T).name()) == 0)
172  {
173  NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(T *), *m_valueType);
174  *reinterpret_cast<const T **>(pValue) = pObject;
175  m_found = true;
176  return;
177  }
178 
179  if (!m_found && searchFirst)
180  m_found = searchFirst->GetVoidValue(m_name, valueType, pValue);
181 
182  if (!m_found && typeid(T) != typeid(BASE))
183  m_found = pObject->BASE::GetVoidValue(m_name, valueType, pValue);
184  }
185 
186  operator bool() const {return m_found;}
187 
188  template <class R>
189  GetValueHelperClass<T,BASE> & operator()(const char *name, const R & (T::*pm)() const)
190  {
191  if (m_getValueNames)
192  (*reinterpret_cast<std::string *>(m_pValue) += name) += ";";
193  if (!m_found && strcmp(name, m_name) == 0)
194  {
195  NameValuePairs::ThrowIfTypeMismatch(name, typeid(R), *m_valueType);
196  *reinterpret_cast<R *>(m_pValue) = (m_pObject->*pm)();
197  m_found = true;
198  }
199  return *this;
200  }
201 
202  GetValueHelperClass<T,BASE> &Assignable()
203  {
204 #ifndef __INTEL_COMPILER // ICL 9.1 workaround: Intel compiler copies the vTable pointer for some reason
205  if (m_getValueNames)
206  ((*reinterpret_cast<std::string *>(m_pValue) += "ThisObject:") += typeid(T).name()) += ';';
207  if (!m_found && strncmp(m_name, "ThisObject:", 11) == 0 && strcmp(m_name+11, typeid(T).name()) == 0)
208  {
209  NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(T), *m_valueType);
210  *reinterpret_cast<T *>(m_pValue) = *m_pObject;
211  m_found = true;
212  }
213 #endif
214  return *this;
215  }
216 
217 private:
218  const T *m_pObject;
219  const char *m_name;
220  const std::type_info *m_valueType;
221  void *m_pValue;
222  bool m_found, m_getValueNames;
223 };
224 
225 template <class BASE, class T>
226 GetValueHelperClass<T, BASE> GetValueHelper(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst=NULLPTR)
227 {
228  return GetValueHelperClass<T, BASE>(pObject, name, valueType, pValue, searchFirst);
229 }
230 
231 template <class T>
232 GetValueHelperClass<T, T> GetValueHelper(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst=NULLPTR)
233 {
234  return GetValueHelperClass<T, T>(pObject, name, valueType, pValue, searchFirst);
235 }
236 
237 // ********************************************************
238 
239 template <class T, class BASE>
240 class AssignFromHelperClass
241 {
242 public:
243  AssignFromHelperClass(T *pObject, const NameValuePairs &source)
244  : m_pObject(pObject), m_source(source), m_done(false)
245  {
246  if (source.GetThisObject(*pObject))
247  m_done = true;
248  else if (typeid(BASE) != typeid(T))
249  pObject->BASE::AssignFrom(source);
250  }
251 
252  template <class R>
253  AssignFromHelperClass & operator()(const char *name, void (T::*pm)(const R&))
254  {
255  if (!m_done)
256  {
257  R value;
258  if (!m_source.GetValue(name, value))
259  throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
260  (m_pObject->*pm)(value);
261  }
262  return *this;
263  }
264 
265  template <class R, class S>
266  AssignFromHelperClass & operator()(const char *name1, const char *name2, void (T::*pm)(const R&, const S&))
267  {
268  if (!m_done)
269  {
270  R value1;
271  if (!m_source.GetValue(name1, value1))
272  throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name1 + "'");
273  S value2;
274  if (!m_source.GetValue(name2, value2))
275  throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name2 + "'");
276  (m_pObject->*pm)(value1, value2);
277  }
278  return *this;
279  }
280 
281 private:
282  T *m_pObject;
283  const NameValuePairs &m_source;
284  bool m_done;
285 };
286 
287 template <class BASE, class T>
288 AssignFromHelperClass<T, BASE> AssignFromHelper(T *pObject, const NameValuePairs &source)
289 {
290  return AssignFromHelperClass<T, BASE>(pObject, source);
291 }
292 
293 template <class T>
294 AssignFromHelperClass<T, T> AssignFromHelper(T *pObject, const NameValuePairs &source)
295 {
296  return AssignFromHelperClass<T, T>(pObject, source);
297 }
298 
299 #endif // CRYPTOPP_DOXYGEN_PROCESSING
300 
301 // ********************************************************
302 
303 #ifndef CRYPTOPP_NO_ASSIGN_TO_INTEGER
304 // Allow the linker to discard Integer code if not needed.
305 // Also see http://github.com/weidai11/cryptopp/issues/389.
306 CRYPTOPP_DLL bool AssignIntToInteger(const std::type_info &valueType, void *pInteger, const void *pInt);
307 #endif
308 
309 CRYPTOPP_DLL const std::type_info & CRYPTOPP_API IntegerTypeId();
310 
311 /// \class AlgorithmParametersBase
312 /// \brief Base class for AlgorithmParameters
313 class CRYPTOPP_DLL AlgorithmParametersBase
314 {
315 public:
316  /// \class ParameterNotUsed
317  /// \brief Exception thrown when an AlgorithmParameter is unused
319  {
320  public:
321  ParameterNotUsed(const char *name) : Exception(OTHER_ERROR, std::string("AlgorithmParametersBase: parameter \"") + name + "\" not used") {}
322  };
323 
324  virtual ~AlgorithmParametersBase() CRYPTOPP_THROW
325  {
326 #ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
327  if (!std::uncaught_exception())
328 #else
329  try
330 #endif
331  {
332  if (m_throwIfNotUsed && !m_used)
333  throw ParameterNotUsed(m_name);
334  }
335 #ifndef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
336  catch(const Exception&)
337  {
338  }
339 #endif
340  }
341 
342  // this is actually a move, not a copy
344  : m_name(x.m_name), m_throwIfNotUsed(x.m_throwIfNotUsed), m_used(x.m_used)
345  {
346  m_next.reset(const_cast<AlgorithmParametersBase &>(x).m_next.release());
347  x.m_used = true;
348  }
349 
350  /// \brief Construct a AlgorithmParametersBase
351  /// \param name the parameter name
352  /// \param throwIfNotUsed flags indicating whether an exception should be thrown
353  /// \details If throwIfNotUsed is true, then a ParameterNotUsed exception
354  /// will be thrown in the destructor if the parameter is not not retrieved.
355  AlgorithmParametersBase(const char *name, bool throwIfNotUsed)
356  : m_name(name), m_throwIfNotUsed(throwIfNotUsed), m_used(false) {}
357 
358  bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const;
359 
360 protected:
361  friend class AlgorithmParameters;
362  void operator=(const AlgorithmParametersBase& rhs); // assignment not allowed, declare this for VC60
363 
364  virtual void AssignValue(const char *name, const std::type_info &valueType, void *pValue) const =0;
365  virtual void MoveInto(void *p) const =0; // not really const
366 
367  const char *m_name;
368  bool m_throwIfNotUsed;
369  mutable bool m_used;
371 };
372 
373 /// \class AlgorithmParametersTemplate
374 /// \brief Template base class for AlgorithmParameters
375 /// \tparam T the class or type
376 template <class T>
378 {
379 public:
380  /// \brief Construct an AlgorithmParametersTemplate
381  /// \param name the name of the value
382  /// \param value a reference to the value
383  /// \param throwIfNotUsed flags indicating whether an exception should be thrown
384  /// \details If throwIfNotUsed is true, then a ParameterNotUsed exception
385  /// will be thrown in the destructor if the parameter is not not retrieved.
386  AlgorithmParametersTemplate(const char *name, const T &value, bool throwIfNotUsed)
387  : AlgorithmParametersBase(name, throwIfNotUsed), m_value(value)
388  {
389  }
390 
391  void AssignValue(const char *name, const std::type_info &valueType, void *pValue) const
392  {
393 #ifndef CRYPTOPP_NO_ASSIGN_TO_INTEGER
394  // Special case for retrieving an Integer parameter when an int was passed in
395  if (!(typeid(T) == typeid(int) && AssignIntToInteger(valueType, pValue, &m_value)))
396 #endif
397  {
398  NameValuePairs::ThrowIfTypeMismatch(name, typeid(T), valueType);
399  *reinterpret_cast<T *>(pValue) = m_value;
400  }
401  }
402 
403 #if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
404 # pragma push_macro("new")
405 # undef new
406 #endif
407 
408  void MoveInto(void *buffer) const
409  {
411  CRYPTOPP_UNUSED(p); // silence warning
412  }
413 
414 #if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
415 # pragma pop_macro("new")
416 #endif
417 
418 protected:
419  T m_value;
420 };
421 
422 CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<bool>;
423 CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<int>;
424 CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<ConstByteArrayParameter>;
425 
426 /// \class AlgorithmParameters
427 /// \brief An object that implements NameValuePairs
428 /// \note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by
429 /// repeatedly using operator() on the object returned by MakeParameters, for example:
430 /// <pre>
431 /// AlgorithmParameters parameters = MakeParameters(name1, value1)(name2, value2)(name3, value3);
432 /// </pre>
433 class CRYPTOPP_DLL AlgorithmParameters : public NameValuePairs
434 {
435 public:
436  /// \brief Construct a AlgorithmParameters
437  /// \note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by
438  /// repeatedly using operator() on the object returned by MakeParameters, for example:
439  /// <pre>
440  /// AlgorithmParameters parameters = MakeParameters(name1, value1)(name2, value2)(name3, value3);
441  /// </pre>
443 
444 #ifdef __BORLANDC__
445  /// \brief Construct a AlgorithmParameters
446  /// \tparam T the class or type
447  /// \param name the name of the object or value to retrieve
448  /// \param value reference to a variable that receives the value
449  /// \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed
450  /// \note throwIfNotUsed is ignored if using a compiler that does not support std::uncaught_exception(),
451  /// such as MSVC 7.0 and earlier.
452  /// \note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by
453  /// repeatedly using operator() on the object returned by MakeParameters, for example:
454  /// <pre>
455  /// AlgorithmParameters parameters = MakeParameters(name1, value1)(name2, value2)(name3, value3);
456  /// </pre>
457  template <class T>
458  AlgorithmParameters(const char *name, const T &value, bool throwIfNotUsed=true)
459  : m_next(new AlgorithmParametersTemplate<T>(name, value, throwIfNotUsed))
460  , m_defaultThrowIfNotUsed(throwIfNotUsed)
461  {
462  }
463 #endif
464 
466 
467  AlgorithmParameters & operator=(const AlgorithmParameters &x);
468 
469  /// \tparam T the class or type
470  /// \param name the name of the object or value to retrieve
471  /// \param value reference to a variable that receives the value
472  /// \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed
473  template <class T>
474  AlgorithmParameters & operator()(const char *name, const T &value, bool throwIfNotUsed)
475  {
476  member_ptr<AlgorithmParametersBase> p(new AlgorithmParametersTemplate<T>(name, value, throwIfNotUsed));
477  p->m_next.reset(m_next.release());
478  m_next.reset(p.release());
479  m_defaultThrowIfNotUsed = throwIfNotUsed;
480  return *this;
481  }
482 
483  /// \brief Appends a NameValuePair to a collection of NameValuePairs
484  /// \tparam T the class or type
485  /// \param name the name of the object or value to retrieve
486  /// \param value reference to a variable that receives the value
487  template <class T>
488  AlgorithmParameters & operator()(const char *name, const T &value)
489  {
490  return operator()(name, value, m_defaultThrowIfNotUsed);
491  }
492 
493  bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const;
494 
495 protected:
497  bool m_defaultThrowIfNotUsed;
498 };
499 
500 /// \brief Create an object that implements NameValuePairs
501 /// \tparam T the class or type
502 /// \param name the name of the object or value to retrieve
503 /// \param value reference to a variable that receives the value
504 /// \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed
505 /// \note throwIfNotUsed is ignored if using a compiler that does not support std::uncaught_exception(),
506 /// such as MSVC 7.0 and earlier.
507 /// \note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by
508 /// repeatedly using \p operator() on the object returned by \p MakeParameters, for example:
509 /// <pre>
510 /// AlgorithmParameters parameters = MakeParameters(name1, value1)(name2, value2)(name3, value3);
511 /// </pre>
512 #ifdef __BORLANDC__
514 #else
515 template <class T>
516 AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed = true)
517 {
518  return AlgorithmParameters()(name, value, throwIfNotUsed);
519 }
520 #endif
521 
522 #define CRYPTOPP_GET_FUNCTION_ENTRY(name) (Name::name(), &ThisClass::Get##name)
523 #define CRYPTOPP_SET_FUNCTION_ENTRY(name) (Name::name(), &ThisClass::Set##name)
524 #define CRYPTOPP_SET_FUNCTION_ENTRY2(name1, name2) (Name::name1(), Name::name2(), &ThisClass::Set##name1##And##name2)
525 
526 // TODO: fix 6011 when the API/ABI can change
527 #if (CRYPTOPP_MSC_VERSION >= 1400)
528 # pragma warning(pop)
529 #endif
530 
531 NAMESPACE_END
532 
533 #endif
Used to pass byte array input as part of a NameValuePairs object.
Definition: algparam.h:31
Base class for all exceptions thrown by the library.
Definition: cryptlib.h:157
An invalid argument was detected.
Definition: cryptlib.h:201
CombinedNameValuePairs(const NameValuePairs &pairs1, const NameValuePairs &pairs2)
Construct a CombinedNameValuePairs.
Definition: algparam.h:143
Utility functions for the Crypto++ library.
Base class for AlgorithmParameters.
Definition: algparam.h:313
size_t size() const
Length of the memory block.
Definition: algparam.h:125
size_t size() const
Length of the memory block.
Definition: algparam.h:95
ConstByteArrayParameter(const T &string, bool deepCopy=false)
Construct a ConstByteArrayParameter.
Definition: algparam.h:63
AlgorithmParametersBase(const char *name, bool throwIfNotUsed)
Construct a AlgorithmParametersBase.
Definition: algparam.h:355
ConstByteArrayParameter(const byte *data, size_t size, bool deepCopy=false)
Construct a ConstByteArrayParameter.
Definition: algparam.h:51
bool GetThisObject(T &object) const
Get a copy of this object or subobject.
Definition: cryptlib.h:330
Abstract base classes that provide a uniform interface to this library.
Classes for automatic resource management.
Library configuration file.
ConstByteArrayParameter(const char *data=NULL, bool deepCopy=false)
Construct a ConstByteArrayParameter.
Definition: algparam.h:39
Combines two sets of NameValuePairs.
Definition: algparam.h:137
SecBlock<byte> typedef.
Definition: secblock.h:828
Used to pass byte array input as part of a NameValuePairs object.
Definition: algparam.h:106
Classes and functions for secure memory allocations.
const byte * begin() const
Pointer to the first byte in the memory block.
Definition: algparam.h:91
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Definition: algparam.h:516
#define CRYPTOPP_COMPILE_ASSERT(expr)
Compile time assertion.
Definition: misc.h:144
Exception thrown when an AlgorithmParameter is unused.
Definition: algparam.h:318
void Assign(const byte *data, size_t size, bool deepCopy)
Assign contents from a memory buffer.
Definition: algparam.h:76
const byte * end() const
Pointer beyond the last byte in the memory block.
Definition: algparam.h:93
virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const =0
Get a named value.
Template base class for AlgorithmParameters.
Definition: algparam.h:377
AlgorithmParameters & operator()(const char *name, const T &value)
Appends a NameValuePair to a collection of NameValuePairs.
Definition: algparam.h:488
ByteArrayParameter(byte *data=NULL, unsigned int size=0)
Construct a ByteArrayParameter.
Definition: algparam.h:112
ByteArrayParameter(SecByteBlock &block)
Construct a ByteArrayParameter.
Definition: algparam.h:117
static void ThrowIfTypeMismatch(const char *name, const std::type_info &stored, const std::type_info &retrieving)
Ensures an expected name and type is present.
Definition: cryptlib.h:409
AlgorithmParameters & operator()(const char *name, const T &value, bool throwIfNotUsed)
Definition: algparam.h:474
byte * begin() const
Pointer to the first byte in the memory block.
Definition: algparam.h:121
An object that implements NameValuePairs.
Definition: algparam.h:433
Multiple precision integer with arithmetic operations.
AlgorithmParametersTemplate(const char *name, const T &value, bool throwIfNotUsed)
Construct an AlgorithmParametersTemplate.
Definition: algparam.h:386
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:294
byte * end() const
Pointer beyond the last byte in the memory block.
Definition: algparam.h:123