Crypto++  6.0
Free C++ class library of cryptographic schemes
modes.h
Go to the documentation of this file.
1 // modes.h - originally written and placed in the public domain by Wei Dai
2 
3 /// \file modes.h
4 /// \brief Classes for block cipher modes of operation
5 
6 #ifndef CRYPTOPP_MODES_H
7 #define CRYPTOPP_MODES_H
8 
9 #include "cryptlib.h"
10 #include "secblock.h"
11 #include "misc.h"
12 #include "strciphr.h"
13 #include "argnames.h"
14 #include "algparam.h"
15 
16 // Issue 340
17 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
18 # pragma GCC diagnostic push
19 # pragma GCC diagnostic ignored "-Wconversion"
20 # pragma GCC diagnostic ignored "-Wsign-conversion"
21 #endif
22 
23 #if CRYPTOPP_MSC_VERSION
24 # pragma warning(push)
25 # pragma warning(disable: 4231 4275)
26 # if (CRYPTOPP_MSC_VERSION >= 1400)
27 # pragma warning(disable: 6011 6386 28193)
28 # endif
29 #endif
30 
31 NAMESPACE_BEGIN(CryptoPP)
32 
33 /// \brief Block cipher mode of operation information
34 /// \details Each class derived from this one defines two types, Encryption and Decryption,
35 /// both of which implement the SymmetricCipher interface.
36 /// For each mode there are two classes, one of which is a template class,
37 /// and the other one has a name that ends in "_ExternalCipher".
38 /// The "external cipher" mode objects hold a reference to the underlying block cipher,
39 /// instead of holding an instance of it. The reference must be passed in to the constructor.
40 /// For the "cipher holder" classes, the CIPHER template parameter should be a class
41 /// derived from BlockCipherDocumentation, for example DES or AES.
42 /// \details See NIST SP 800-38A for definitions of these modes. See
43 /// AuthenticatedSymmetricCipherDocumentation for authenticated encryption modes.
45 {
46 };
47 
48 /// \brief Block cipher mode of operation information
49 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CipherModeBase : public SymmetricCipher
50 {
51 public:
52  virtual ~CipherModeBase() {}
53  size_t MinKeyLength() const {return m_cipher->MinKeyLength();}
54  size_t MaxKeyLength() const {return m_cipher->MaxKeyLength();}
55  size_t DefaultKeyLength() const {return m_cipher->DefaultKeyLength();}
56  size_t GetValidKeyLength(size_t n) const {return m_cipher->GetValidKeyLength(n);}
57  bool IsValidKeyLength(size_t n) const {return m_cipher->IsValidKeyLength(n);}
58 
59  unsigned int OptimalDataAlignment() const {return m_cipher->OptimalDataAlignment();}
60 
61  unsigned int IVSize() const {return BlockSize();}
62  virtual IV_Requirement IVRequirement() const =0;
63 
64  void SetCipher(BlockCipher &cipher)
65  {
66  this->ThrowIfResynchronizable();
67  this->m_cipher = &cipher;
68  this->ResizeBuffers();
69  }
70 
71  void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
72  {
73  this->ThrowIfInvalidIV(iv);
74  this->m_cipher = &cipher;
75  this->ResizeBuffers();
76  this->SetFeedbackSize(feedbackSize);
77  if (this->IsResynchronizable())
78  this->Resynchronize(iv);
79  }
80 
81 protected:
82  CipherModeBase() : m_cipher(NULLPTR) {}
83  inline unsigned int BlockSize() const {CRYPTOPP_ASSERT(m_register.size() > 0); return (unsigned int)m_register.size();}
84  virtual void SetFeedbackSize(unsigned int feedbackSize)
85  {
86  if (!(feedbackSize == 0 || feedbackSize == BlockSize()))
87  throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode");
88  }
89 
90  virtual void ResizeBuffers();
91 
92  BlockCipher *m_cipher;
93  AlignedSecByteBlock m_register;
94 };
95 
96 /// \brief Block cipher mode of operation common operations
97 /// \tparam POLICY_INTERFACE common operations
98 template <class POLICY_INTERFACE>
99 class CRYPTOPP_NO_VTABLE ModePolicyCommonTemplate : public CipherModeBase, public POLICY_INTERFACE
100 {
101  unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();}
102  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
103 };
104 
105 template <class POLICY_INTERFACE>
106 void ModePolicyCommonTemplate<POLICY_INTERFACE>::CipherSetKey(const NameValuePairs &params, const byte *key, size_t length)
107 {
108  m_cipher->SetKey(key, length, params);
109  ResizeBuffers();
110  int feedbackSize = params.GetIntValueWithDefault(Name::FeedbackSize(), 0);
111  SetFeedbackSize(feedbackSize);
112 }
113 
114 /// \brief CFB block cipher mode of operation
115 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTemplate<CFB_CipherAbstractPolicy>
116 {
117 public:
118  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CFB";}
119 
120  virtual ~CFB_ModePolicy() {}
121  IV_Requirement IVRequirement() const {return RANDOM_IV;}
122 
123 protected:
124  unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
125  byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;}
126  bool CanIterate() const {return m_feedbackSize == BlockSize();}
127  void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount);
128  void TransformRegister();
129  void CipherResynchronize(const byte *iv, size_t length);
130  void SetFeedbackSize(unsigned int feedbackSize);
131  void ResizeBuffers();
132 
133  SecByteBlock m_temp;
134  unsigned int m_feedbackSize;
135 };
136 
137 inline void CopyOrZero(void *dest, size_t d, const void *src, size_t s)
138 {
139  CRYPTOPP_ASSERT(dest);
140  CRYPTOPP_ASSERT(d >= s);
141 
142  if (src)
143  memcpy_s(dest, d, src, s);
144  else
145  memset(dest, 0, d);
146 }
147 
148 /// \brief OFB block cipher mode of operation
149 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
150 {
151 public:
152  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
153 
154  bool CipherIsRandomAccess() const {return false;}
155  IV_Requirement IVRequirement() const {return UNIQUE_IV;}
156 
157 private:
158  unsigned int GetBytesPerIteration() const {return BlockSize();}
159  unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
160  void WriteKeystream(byte *keystreamBuffer, size_t iterationCount);
161  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
162 };
163 
164 /// \brief CTR block cipher mode of operation
165 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
166 {
167 public:
168  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
169 
170  virtual ~CTR_ModePolicy() {}
171  bool CipherIsRandomAccess() const {return true;}
172  IV_Requirement IVRequirement() const {return RANDOM_IV;}
173 
174 protected:
175  virtual void IncrementCounterBy256();
176  unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();}
177  unsigned int GetBytesPerIteration() const {return BlockSize();}
178  unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
179  void WriteKeystream(byte *buffer, size_t iterationCount)
180  {OperateKeystream(WRITE_KEYSTREAM, buffer, NULLPTR, iterationCount);}
181  bool CanOperateKeystream() const {return true;}
182  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
183  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
184  void SeekToIteration(lword iterationCount);
185 
186  AlignedSecByteBlock m_counterArray;
187 };
188 
189 /// \brief Block cipher mode of operation default implementation
190 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockOrientedCipherModeBase : public CipherModeBase
191 {
192 public:
193  virtual ~BlockOrientedCipherModeBase() {}
194  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
195  unsigned int MandatoryBlockSize() const {return BlockSize();}
196  bool IsRandomAccess() const {return false;}
197  bool IsSelfInverting() const {return false;}
198  bool IsForwardTransformation() const {return m_cipher->IsForwardTransformation();}
199  void Resynchronize(const byte *iv, int length=-1) {memcpy_s(m_register, m_register.size(), iv, ThrowIfInvalidIVLength(length));}
200 
201 protected:
202  bool RequireAlignedInput() const {return true;}
203  virtual void ResizeBuffers();
204 
205  SecByteBlock m_buffer;
206 };
207 
208 /// \brief ECB block cipher mode of operation default implementation
209 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ECB_OneWay : public BlockOrientedCipherModeBase
210 {
211 public:
212  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "ECB";}
213 
214  void SetKey(const byte *key, size_t length, const NameValuePairs &params = g_nullNameValuePairs)
215  {m_cipher->SetKey(key, length, params); BlockOrientedCipherModeBase::ResizeBuffers();}
216  IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;}
217  unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
218  void ProcessData(byte *outString, const byte *inString, size_t length);
219 };
220 
221 /// \brief CBC block cipher mode of operation default implementation
222 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase
223 {
224 public:
225  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
226 
227  IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
228  bool RequireAlignedInput() const {return false;}
229  unsigned int MinLastBlockSize() const {return 0;}
230 };
231 
232 /// \brief CBC block cipher mode of operation encryption operation
233 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Encryption : public CBC_ModeBase
234 {
235 public:
236  void ProcessData(byte *outString, const byte *inString, size_t length);
237 };
238 
239 /// \brief CBC-CTS block cipher mode of operation encryption operation
240 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Encryption : public CBC_Encryption
241 {
242 public:
243  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
244 
245  void SetStolenIV(byte *iv) {m_stolenIV = iv;}
246  unsigned int MinLastBlockSize() const {return BlockSize()+1;}
247  size_t ProcessLastBlock(byte *outString, size_t outLength, const byte *inString, size_t inLength);
248 
249 protected:
250  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
251  {
252  CBC_Encryption::UncheckedSetKey(key, length, params);
253  m_stolenIV = params.GetValueWithDefault(Name::StolenIV(), (byte *)NULLPTR);
254  }
255 
256  byte *m_stolenIV;
257 };
258 
259 /// \brief CBC block cipher mode of operation decryption operation
260 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Decryption : public CBC_ModeBase
261 {
262 public:
263  virtual ~CBC_Decryption() {}
264  void ProcessData(byte *outString, const byte *inString, size_t length);
265 
266 protected:
267  virtual void ResizeBuffers();
268 
269  AlignedSecByteBlock m_temp;
270 };
271 
272 /// \brief CBC-CTS block cipher mode of operation decryption operation
273 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Decryption : public CBC_Decryption
274 {
275 public:
276  unsigned int MinLastBlockSize() const {return BlockSize()+1;}
277  size_t ProcessLastBlock(byte *outString, size_t outLength, const byte *inString, size_t inLength);
278 };
279 
280 /// \brief Block cipher mode of operation aggregate
281 template <class CIPHER, class BASE>
282 class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> >
283 {
284 public:
285  static std::string CRYPTOPP_API StaticAlgorithmName()
286  {return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
287 
289  {
290  this->m_cipher = &this->m_object;
291  this->ResizeBuffers();
292  }
293  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length)
294  {
295  this->m_cipher = &this->m_object;
296  this->SetKey(key, length);
297  }
298  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv)
299  {
300  this->m_cipher = &this->m_object;
301  this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize())));
302  }
303  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv, int feedbackSize)
304  {
305  this->m_cipher = &this->m_object;
306  this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))(Name::FeedbackSize(), feedbackSize));
307  }
308 };
309 
310 /// \tparam BASE CipherModeFinalTemplate_CipherHolder base class
311 /// \details Base class for external mode cipher combinations
312 template <class BASE>
314 {
315 public:
318  {this->SetCipher(cipher);}
319  CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
320  {this->SetCipherWithIV(cipher, iv, feedbackSize);}
321 
322  std::string AlgorithmName() const
323  {return (this->m_cipher ? this->m_cipher->AlgorithmName() + "/" : std::string("")) + BASE::StaticAlgorithmName();}
324 };
325 
329 
330 /// \brief CFB block cipher mode of operation
331 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
332 /// on the Crypto++ wiki.
333 template <class CIPHER>
335 {
338 };
339 
340 /// \brief CFB mode, external cipher.
341 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
342 /// on the Crypto++ wiki.
344 {
347 };
348 
349 /// \brief CFB block cipher mode of operation providing FIPS validated cryptography.
350 /// \details Requires full block plaintext according to FIPS 800-38A
351 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
352 /// on the Crypto++ wiki.
353 template <class CIPHER>
355 {
358 };
359 
360 /// \brief CFB mode, external cipher, providing FIPS validated cryptography.
361 /// \details Requires full block plaintext according to FIPS 800-38A
362 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
363 /// on the Crypto++ wiki.
365 {
368 };
369 
371 
372 /// \brief OFB block cipher mode of operation
373 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
374 /// on the Crypto++ wiki.
375 template <class CIPHER>
377 {
379  typedef Encryption Decryption;
380 };
381 
382 /// \brief OFB mode, external cipher.
383 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
384 /// on the Crypto++ wiki.
386 {
388  typedef Encryption Decryption;
389 };
390 
393 
394 /// \brief CTR block cipher mode of operation
395 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
396 /// on the Crypto++ wiki.
397 template <class CIPHER>
399 {
401  typedef Encryption Decryption;
402 };
403 
404 /// \brief CTR mode, external cipher.
405 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
406 /// on the Crypto++ wiki.
408 {
410  typedef Encryption Decryption;
411 };
412 
413 /// \brief ECB block cipher mode of operation
414 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
415 /// on the Crypto++ wiki.
416 template <class CIPHER>
418 {
421 };
422 
423 CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<ECB_OneWay>;
424 
425 /// \brief ECB mode, external cipher.
426 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
427 /// on the Crypto++ wiki.
429 {
431  typedef Encryption Decryption;
432 };
433 
434 /// \brief CBC block cipher mode of operation
435 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
436 /// on the Crypto++ wiki.
437 template <class CIPHER>
439 {
442 };
443 
446 
447 /// \brief CBC mode, external cipher
448 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
449 /// on the Crypto++ wiki.
451 {
454 };
455 
456 /// \brief CBC-CTS block cipher mode of operation
457 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
458 /// on the Crypto++ wiki.
459 template <class CIPHER>
461 {
464 };
465 
468 
469 /// \brief CBC mode with ciphertext stealing, external cipher
470 /// \sa <A HREF="http://www.cryptopp.com/wiki/Modes_of_Operation">Modes of Operation</A>
471 /// on the Crypto++ wiki.
473 {
476 };
477 
478 NAMESPACE_END
479 
480 // Issue 340
481 #if CRYPTOPP_MSC_VERSION
482 # pragma warning(pop)
483 #endif
484 
485 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
486 # pragma GCC diagnostic pop
487 #endif
488 
489 #endif
Used to pass byte array input as part of a NameValuePairs object.
Definition: algparam.h:21
int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
Definition: cryptlib.h:393
Standard names for retrieving values by name when working with NameValuePairs.
An invalid argument was detected.
Definition: cryptlib.h:200
const char * FeedbackSize()
int
Definition: argnames.h:25
void Resynchronize(const byte *iv, int length=-1)
Resynchronize with an IV.
Definition: modes.h:199
Classes for working with NameValuePairs.
Utility functions for the Crypto++ library.
virtual void SetKey(const byte *key, size_t length, const NameValuePairs &params=g_nullNameValuePairs)
Sets or reset the key of this object.
Definition: cryptlib.cpp:64
size_t GetValidKeyLength(size_t n) const
Returns a valid key length for the algorithm.
Definition: modes.h:56
CFB mode, external cipher, providing FIPS validated cryptography.
Definition: modes.h:364
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
Definition: modes.h:198
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
Definition: cryptlib.h:361
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:172
CipherDir
Specifies a direction for a cipher to operate.
Definition: cryptlib.h:121
Abstract base classes that provide a uniform interface to this library.
void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memcpy()
Definition: misc.h:383
Base class for feedback based stream ciphers with SymmetricCipher interface.
Definition: strciphr.h:480
Wirte the keystream to the output buffer, input is NULL.
Definition: strciphr.h:90
SecBlock<byte> typedef.
Definition: secblock.h:822
CBC-CTS block cipher mode of operation.
Definition: modes.h:460
bool CipherIsRandomAccess() const
Flag indicating random access.
Definition: modes.h:171
size_t MinKeyLength() const
Returns smallest valid key length.
Definition: modes.h:53
bool IsValidKeyLength(size_t n) const
Returns whether keylength is a valid key length.
Definition: modes.h:57
CTR block cipher mode of operation.
Definition: modes.h:398
unsigned int OptimalBlockSize() const
Provides the input block size most efficient for this cipher.
Definition: modes.h:217
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1228
const char * StolenIV()
byte *
Definition: argnames.h:22
OFB block cipher mode of operation.
Definition: modes.h:149
CBC-CTS block cipher mode of operation decryption operation.
Definition: modes.h:273
size_t MaxKeyLength() const
Returns largest valid key length.
Definition: modes.h:54
Classes and functions for secure memory allocations.
ECB block cipher mode of operation.
Definition: modes.h:417
Base class for feedback based stream ciphers in the reverse direction with SymmetricCipher interface...
Definition: strciphr.h:551
Uses encapsulation to hide an object in derived classes.
Definition: misc.h:217
CBC-CTS block cipher mode of operation encryption operation.
Definition: modes.h:240
virtual IV_Requirement IVRequirement() const =0
Minimal requirement for secure IVs.
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Definition: algparam.h:500
Block cipher mode of operation aggregate.
Definition: modes.h:282
CFB mode, external cipher.
Definition: modes.h:343
CBC block cipher mode of operation default implementation.
Definition: modes.h:222
bool IsSelfInverting() const
Determines whether the cipher is self-inverting.
Definition: modes.h:197
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:276
virtual void Resynchronize(const byte *iv, int ivLength=-1)
Resynchronize with an IV.
Definition: cryptlib.h:739
void SetKey(const byte *key, size_t length, const NameValuePairs &params=g_nullNameValuePairs)
Sets or reset the key of this object.
Definition: modes.h:214
Block cipher mode of operation information.
Definition: modes.h:44
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1236
unsigned int MandatoryBlockSize() const
Provides the mandatory block size of the cipher.
Definition: modes.h:195
Block cipher mode of operation default implementation.
Definition: modes.h:190
ECB mode, external cipher.
Definition: modes.h:428
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:246
size_t DefaultKeyLength() const
Returns default key length.
Definition: modes.h:55
SecBlock using AllocatorWithCleanup<byte, true> typedef.
Definition: secblock.h:826
Base class for feedback based stream ciphers in the forward direction with SymmetricCipher interface...
Definition: strciphr.h:542
OFB block cipher mode of operation.
Definition: modes.h:376
CBC mode, external cipher.
Definition: modes.h:450
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Definition: trap.h:60
const char * BlockSize()
int, in bytes
Definition: argnames.h:27
CFB block cipher mode of operation.
Definition: modes.h:334
CTR block cipher mode of operation.
Definition: modes.h:165
OFB mode, external cipher.
Definition: modes.h:385
const char * IV()
ConstByteArrayParameter, also accepts const byte * for backwards compatibility.
Definition: argnames.h:21
Classes for implementing stream ciphers.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:434
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
Definition: modes.h:59
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:121
const NameValuePairs g_nullNameValuePairs
An empty set of name-value pairs.
Definition: cryptlib.h:496
IV_Requirement
Secure IVs requirements as enumerated values.
Definition: cryptlib.h:675
Block cipher mode of operation information.
Definition: modes.h:49
CBC block cipher mode of operation decryption operation.
Definition: modes.h:260
CTR mode, external cipher.
Definition: modes.h:407
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:229
CBC block cipher mode of operation encryption operation.
Definition: modes.h:233
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
Sets the key for this object without performing parameter validation.
Definition: modes.cpp:151
Block cipher mode of operation common operations.
Definition: modes.h:99
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:88
Crypto++ library namespace.
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:216
unsigned int IVSize() const
Returns length of the IV accepted by this object.
Definition: modes.h:61
bool IsResynchronizable() const
Determines if the object can be resynchronized.
Definition: cryptlib.h:696
bool CipherIsRandomAccess() const
Flag indicating random access.
Definition: modes.h:154
CFB block cipher mode of operation.
Definition: modes.h:115
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:227
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:155
Base class for additive stream ciphers with SymmetricCipher interface.
Definition: strciphr.h:261
CFB block cipher mode of operation providing FIPS validated cryptography.
Definition: modes.h:354
ECB block cipher mode of operation default implementation.
Definition: modes.h:209
bool IsRandomAccess() const
Determines whether the cipher supports random access.
Definition: modes.h:196
Interface for retrieving values given their names.
Definition: cryptlib.h:291
CBC block cipher mode of operation.
Definition: modes.h:438
CBC mode with ciphertext stealing, external cipher.
Definition: modes.h:472
Base class information.
Definition: simple.h:36