Crypto++  5.6.5
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 Class file for 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 NAMESPACE_BEGIN(CryptoPP)
24 
25 //! \class CipherModeDocumentation
26 //! \brief Block cipher mode of operation information
27 //! \details Each class derived from this one defines two types, Encryption and Decryption,
28 //! both of which implement the SymmetricCipher interface.
29 //! For each mode there are two classes, one of which is a template class,
30 //! and the other one has a name that ends in "_ExternalCipher".
31 //! The "external cipher" mode objects hold a reference to the underlying block cipher,
32 //! instead of holding an instance of it. The reference must be passed in to the constructor.
33 //! For the "cipher holder" classes, the CIPHER template parameter should be a class
34 //! derived from BlockCipherDocumentation, for example DES or AES.
35 //! \details See NIST SP 800-38A for definitions of these modes. See
36 //! AuthenticatedSymmetricCipherDocumentation for authenticated encryption modes.
38 {
39 };
40 
41 //! \class CipherModeBase
42 //! \brief Block cipher mode of operation information
43 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CipherModeBase : public SymmetricCipher
44 {
45 public:
46  virtual ~CipherModeBase() {}
47  size_t MinKeyLength() const {return m_cipher->MinKeyLength();}
48  size_t MaxKeyLength() const {return m_cipher->MaxKeyLength();}
49  size_t DefaultKeyLength() const {return m_cipher->DefaultKeyLength();}
50  size_t GetValidKeyLength(size_t n) const {return m_cipher->GetValidKeyLength(n);}
51  bool IsValidKeyLength(size_t n) const {return m_cipher->IsValidKeyLength(n);}
52 
53  unsigned int OptimalDataAlignment() const {return m_cipher->OptimalDataAlignment();}
54 
55  unsigned int IVSize() const {return BlockSize();}
56  virtual IV_Requirement IVRequirement() const =0;
57 
58  void SetCipher(BlockCipher &cipher)
59  {
60  this->ThrowIfResynchronizable();
61  this->m_cipher = &cipher;
62  this->ResizeBuffers();
63  }
64 
65  void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
66  {
67  this->ThrowIfInvalidIV(iv);
68  this->m_cipher = &cipher;
69  this->ResizeBuffers();
70  this->SetFeedbackSize(feedbackSize);
71  if (this->IsResynchronizable())
72  this->Resynchronize(iv);
73  }
74 
75 protected:
76  CipherModeBase() : m_cipher(NULLPTR) {}
77  inline unsigned int BlockSize() const {CRYPTOPP_ASSERT(m_register.size() > 0); return (unsigned int)m_register.size();}
78  virtual void SetFeedbackSize(unsigned int feedbackSize)
79  {
80  if (!(feedbackSize == 0 || feedbackSize == BlockSize()))
81  throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode");
82  }
83 
84  virtual void ResizeBuffers();
85 
86  BlockCipher *m_cipher;
87  AlignedSecByteBlock m_register;
88 };
89 
90 //! \class ModePolicyCommonTemplate
91 //! \brief Block cipher mode of operation common operations
92 //! \tparam POLICY_INTERFACE common operations
93 template <class POLICY_INTERFACE>
94 class CRYPTOPP_NO_VTABLE ModePolicyCommonTemplate : public CipherModeBase, public POLICY_INTERFACE
95 {
96  unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();}
97  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
98 };
99 
100 template <class POLICY_INTERFACE>
101 void ModePolicyCommonTemplate<POLICY_INTERFACE>::CipherSetKey(const NameValuePairs &params, const byte *key, size_t length)
102 {
103  m_cipher->SetKey(key, length, params);
104  ResizeBuffers();
105  int feedbackSize = params.GetIntValueWithDefault(Name::FeedbackSize(), 0);
106  SetFeedbackSize(feedbackSize);
107 }
108 
109 //! \class CFB_ModePolicy
110 //! \brief CFB block cipher mode of operation
111 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTemplate<CFB_CipherAbstractPolicy>
112 {
113 public:
114  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CFB";}
115 
116  virtual ~CFB_ModePolicy() {}
117  IV_Requirement IVRequirement() const {return RANDOM_IV;}
118 
119 protected:
120  unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
121  byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;}
122  bool CanIterate() const {return m_feedbackSize == BlockSize();}
123  void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount);
124  void TransformRegister();
125  void CipherResynchronize(const byte *iv, size_t length);
126  void SetFeedbackSize(unsigned int feedbackSize);
127  void ResizeBuffers();
128 
129  SecByteBlock m_temp;
130  unsigned int m_feedbackSize;
131 };
132 
133 inline void CopyOrZero(void *dest, size_t d, const void *src, size_t s)
134 {
135  CRYPTOPP_ASSERT(dest);
136  CRYPTOPP_ASSERT(d >= s);
137 
138  if (src)
139  memcpy_s(dest, d, src, s);
140  else
141  memset(dest, 0, d);
142 }
143 
144 //! \class OFB_ModePolicy
145 //! \brief OFB block cipher mode of operation
146 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
147 {
148 public:
149  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
150 
151  bool CipherIsRandomAccess() const {return false;}
152  IV_Requirement IVRequirement() const {return UNIQUE_IV;}
153 
154 private:
155  unsigned int GetBytesPerIteration() const {return BlockSize();}
156  unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
157  void WriteKeystream(byte *keystreamBuffer, size_t iterationCount);
158  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
159 };
160 
161 //! \class CTR_ModePolicy
162 //! \brief CTR block cipher mode of operation
163 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
164 {
165 public:
166  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
167 
168  virtual ~CTR_ModePolicy() {}
169  bool CipherIsRandomAccess() const {return true;}
170  IV_Requirement IVRequirement() const {return RANDOM_IV;}
171 
172 protected:
173  virtual void IncrementCounterBy256();
174  unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();}
175  unsigned int GetBytesPerIteration() const {return BlockSize();}
176  unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
177  void WriteKeystream(byte *buffer, size_t iterationCount)
178  {OperateKeystream(WRITE_KEYSTREAM, buffer, NULLPTR, iterationCount);}
179  bool CanOperateKeystream() const {return true;}
180  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
181  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
182  void SeekToIteration(lword iterationCount);
183 
184  AlignedSecByteBlock m_counterArray;
185 };
186 
187 //! \class BlockOrientedCipherModeBase
188 //! \brief Block cipher mode of operation default implementation
189 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockOrientedCipherModeBase : public CipherModeBase
190 {
191 public:
192  virtual ~BlockOrientedCipherModeBase() {}
193  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
194  unsigned int MandatoryBlockSize() const {return BlockSize();}
195  bool IsRandomAccess() const {return false;}
196  bool IsSelfInverting() const {return false;}
197  bool IsForwardTransformation() const {return m_cipher->IsForwardTransformation();}
198  void Resynchronize(const byte *iv, int length=-1) {memcpy_s(m_register, m_register.size(), iv, ThrowIfInvalidIVLength(length));}
199 
200 protected:
201  bool RequireAlignedInput() const {return true;}
202  virtual void ResizeBuffers();
203 
204  SecByteBlock m_buffer;
205 };
206 
207 //! \class ECB_OneWay
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 //! \class CBC_ModeBase
222 //! \brief CBC block cipher mode of operation default implementation
223 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase
224 {
225 public:
226  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
227 
228  IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
229  bool RequireAlignedInput() const {return false;}
230  unsigned int MinLastBlockSize() const {return 0;}
231 };
232 
233 //! \class CBC_Encryption
234 //! \brief CBC block cipher mode of operation encryption operation
235 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Encryption : public CBC_ModeBase
236 {
237 public:
238  void ProcessData(byte *outString, const byte *inString, size_t length);
239 };
240 
241 //! \class CBC_CTS_Encryption
242 //! \brief CBC-CTS block cipher mode of operation encryption operation
243 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Encryption : public CBC_Encryption
244 {
245 public:
246  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
247 
248  void SetStolenIV(byte *iv) {m_stolenIV = iv;}
249  unsigned int MinLastBlockSize() const {return BlockSize()+1;}
250  void ProcessLastBlock(byte *outString, const byte *inString, size_t length);
251 
252 protected:
253  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
254  {
255  CBC_Encryption::UncheckedSetKey(key, length, params);
256  m_stolenIV = params.GetValueWithDefault(Name::StolenIV(), (byte *)NULLPTR);
257  }
258 
259  byte *m_stolenIV;
260 };
261 
262 //! \class CBC_Decryption
263 //! \brief CBC block cipher mode of operation decryption operation
264 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Decryption : public CBC_ModeBase
265 {
266 public:
267  virtual ~CBC_Decryption() {}
268  void ProcessData(byte *outString, const byte *inString, size_t length);
269 
270 protected:
271  virtual void ResizeBuffers();
272 
273  AlignedSecByteBlock m_temp;
274 };
275 
276 //! \class CBC_CTS_Decryption
277 //! \brief CBC-CTS block cipher mode of operation decryption operation
278 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Decryption : public CBC_Decryption
279 {
280 public:
281  unsigned int MinLastBlockSize() const {return BlockSize()+1;}
282  void ProcessLastBlock(byte *outString, const byte *inString, size_t length);
283 };
284 
285 //! \class CipherModeFinalTemplate_CipherHolder
286 //! \brief Block cipher mode of operation aggregate
287 template <class CIPHER, class BASE>
288 class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> >
289 {
290 public:
291  static std::string CRYPTOPP_API StaticAlgorithmName()
292  {return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
293 
295  {
296  this->m_cipher = &this->m_object;
297  this->ResizeBuffers();
298  }
299  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length)
300  {
301  this->m_cipher = &this->m_object;
302  this->SetKey(key, length);
303  }
304  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv)
305  {
306  this->m_cipher = &this->m_object;
307  this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize())));
308  }
309  CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv, int feedbackSize)
310  {
311  this->m_cipher = &this->m_object;
312  this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))(Name::FeedbackSize(), feedbackSize));
313  }
314 };
315 
316 //! \class CipherModeFinalTemplate_ExternalCipher
317 //! \tparam BASE CipherModeFinalTemplate_CipherHolder base class
318 //! \details
319 template <class BASE>
321 {
322 public:
325  {this->SetCipher(cipher);}
326  CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
327  {this->SetCipherWithIV(cipher, iv, feedbackSize);}
328 
329  std::string AlgorithmName() const
330  {return (this->m_cipher ? this->m_cipher->AlgorithmName() + "/" : std::string("")) + BASE::StaticAlgorithmName();}
331 };
332 
336 
337 //! \class CFB_Mode
338 //! \brief CFB block cipher mode of operation.
339 template <class CIPHER>
341 {
344 };
345 
346 //! \class CFB_Mode_ExternalCipher
347 //! \brief CFB mode, external cipher.
349 {
352 };
353 
354 //! \class CFB_FIPS_Mode
355 //! \brief CFB block cipher mode of operation providing FIPS validated cryptography.
356 //! \details Requires full block plaintext according to FIPS 800-38A
357 template <class CIPHER>
359 {
362 };
363 
364 //! \class CFB_FIPS_Mode_ExternalCipher
365 //! \brief CFB mode, external cipher, providing FIPS validated cryptography.
366 //! \details Requires full block plaintext according to FIPS 800-38A
368 {
371 };
372 
374 
375 //! \class OFB_Mode
376 //! \brief OFB block cipher mode of operation.
377 template <class CIPHER>
379 {
381  typedef Encryption Decryption;
382 };
383 
384 //! \class OFB_Mode_ExternalCipher
385 //! \brief OFB mode, external cipher.
387 {
389  typedef Encryption Decryption;
390 };
391 
394 
395 //! \class CTR_Mode
396 //! \brief CTR block cipher mode of operation.
397 template <class CIPHER>
399 {
401  typedef Encryption Decryption;
402 };
403 
404 //! \class CTR_Mode_ExternalCipher
405 //! \brief CTR mode, external cipher.
407 {
409  typedef Encryption Decryption;
410 };
411 
412 //! \class ECB_Mode
413 //! \brief ECB block cipher mode of operation.
414 template <class CIPHER>
416 {
419 };
420 
421 CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<ECB_OneWay>;
422 
423 //! \class ECB_Mode_ExternalCipher
424 //! \brief ECB mode, external cipher.
426 {
428  typedef Encryption Decryption;
429 };
430 
431 //! CBC mode
432 template <class CIPHER>
434 {
437 };
438 
441 
442 //! CBC mode, external cipher
444 {
447 };
448 
449 //! CBC mode with ciphertext stealing
450 template <class CIPHER>
452 {
455 };
456 
459 
460 //! \class CBC_CTS_Mode_ExternalCipher
461 //! \brief CBC mode with ciphertext stealing, external cipher
463 {
466 };
467 
468 //#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
469 //typedef CFB_Mode_ExternalCipher::Encryption CFBEncryption;
470 //typedef CFB_Mode_ExternalCipher::Decryption CFBDecryption;
471 //typedef OFB_Mode_ExternalCipher::Encryption OFB;
472 //typedef CTR_Mode_ExternalCipher::Encryption CounterMode;
473 //#endif
474 
475 NAMESPACE_END
476 
477 // Issue 340
478 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
479 # pragma GCC diagnostic pop
480 #endif
481 
482 #endif
Used to pass byte array input as part of a NameValuePairs object.
Definition: algparam.h:29
int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
Definition: cryptlib.h:388
Standard names for retrieving values by name when working with NameValuePairs.
An invalid argument was detected.
Definition: cryptlib.h:194
const char * FeedbackSize()
int
Definition: argnames.h:25
void Resynchronize(const byte *iv, int length=-1)
Resynchronize with an IV.
Definition: modes.h:198
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:71
size_t GetValidKeyLength(size_t n) const
Returns a valid key length for the algorithm.
Definition: modes.h:50
CFB mode, external cipher, providing FIPS validated cryptography.
Definition: modes.h:367
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
Definition: modes.h:197
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
Definition: cryptlib.h:356
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:170
CipherDir
Specifies a direction for a cipher to operate.
Definition: cryptlib.h:114
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:401
Base class for feedback based stream ciphers with SymmetricCipher interface.
Definition: strciphr.h:489
Wirte the keystream to the output buffer, input is NULL.
Definition: strciphr.h:92
SecBlock<byte> typedef.
Definition: secblock.h:810
CBC mode with ciphertext stealing.
Definition: modes.h:451
bool CipherIsRandomAccess() const
Flag indicating random access.
Definition: modes.h:169
size_t MinKeyLength() const
Returns smallest valid key length.
Definition: modes.h:47
bool IsValidKeyLength(size_t n) const
Returns whether keylength is a valid key length.
Definition: modes.h:51
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:1099
const char * StolenIV()
byte *
Definition: argnames.h:22
OFB block cipher mode of operation.
Definition: modes.h:146
CBC-CTS block cipher mode of operation decryption operation.
Definition: modes.h:278
size_t MaxKeyLength() const
Returns largest valid key length.
Definition: modes.h:48
Classes and functions for secure memory allocations.
ECB block cipher mode of operation.
Definition: modes.h:415
Base class for feedback based stream ciphers in the reverse direction with SymmetricCipher interface...
Definition: strciphr.h:562
Uses encapsulation to hide an object in derived classes.
Definition: misc.h:233
CBC-CTS block cipher mode of operation encryption operation.
Definition: modes.h:243
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:502
Block cipher mode of operation aggregate.
Definition: modes.h:288
CFB mode, external cipher.
Definition: modes.h:348
CBC block cipher mode of operation default implementation.
Definition: modes.h:223
bool IsSelfInverting() const
Determines whether the cipher is self-inverting.
Definition: modes.h:196
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:281
virtual void Resynchronize(const byte *iv, int ivLength=-1)
Resynchronize with an IV.
Definition: cryptlib.h:668
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:37
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1107
unsigned int MandatoryBlockSize() const
Provides the mandatory block size of the cipher.
Definition: modes.h:194
Block cipher mode of operation default implementation.
Definition: modes.h:189
ECB mode, external cipher.
Definition: modes.h:425
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
Definition: cryptlib.cpp:951
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:249
size_t DefaultKeyLength() const
Returns default key length.
Definition: modes.h:49
SecBlock using AllocatorWithCleanup<byte, true> typedef.
Definition: secblock.h:816
Base class for feedback based stream ciphers in the forward direction with SymmetricCipher interface...
Definition: strciphr.h:552
OFB block cipher mode of operation.
Definition: modes.h:378
CBC mode, external cipher.
Definition: modes.h:443
#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:340
CTR block cipher mode of operation.
Definition: modes.h:163
OFB mode, external cipher.
Definition: modes.h:386
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:597
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
Definition: modes.h:53
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:117
IV_Requirement
Secure IVs requirements as enumerated values.
Definition: cryptlib.h:604
Block cipher mode of operation information.
Definition: modes.h:43
CBC block cipher mode of operation decryption operation.
Definition: modes.h:264
CTR mode, external cipher.
Definition: modes.h:406
unsigned int MinLastBlockSize() const
Provides the size of the last block.
Definition: modes.h:230
CBC block cipher mode of operation encryption operation.
Definition: modes.h:235
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:94
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:90
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:55
bool IsResynchronizable() const
Determines if the object can be resynchronized.
Definition: cryptlib.h:625
bool CipherIsRandomAccess() const
Flag indicating random access.
Definition: modes.h:151
CFB block cipher mode of operation.
Definition: modes.h:111
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:228
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Definition: modes.h:152
Base class for additive stream ciphers with SymmetricCipher interface.
Definition: strciphr.h:267
CFB block cipher mode of operation providing FIPS validated cryptography.
Definition: modes.h:358
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:195
Interface for retrieving values given their names.
Definition: cryptlib.h:285
CBC mode.
Definition: modes.h:433
CBC mode with ciphertext stealing, external cipher.
Definition: modes.h:462
Base class for identifying alogorithm.
Definition: simple.h:38