SimpleKeyingInterface
Jump to navigation
Jump to search
| Documentation |
#include <cryptopp/cryptlib.h>
|
SimpleKeyingInterface is a class used by symmetric ciphers to provide functions for security parameters such as keys, initialization vectors and rounds.
Keying Functions
SimpleKeyingInterface provides the following functions for keying material.
| Function | Comments |
|---|---|
| MinKeyLength | minimum key length, in bytes |
| MaxKeyLength | maximum key length, in bytes |
| DefaultKeyLength | default key length, in bytes |
| GetValidKeyLength | returns a valid key length, rounds up to the next valid length if needed |
| IsValidKeyLength | returns true if the key length is valid |
| SetKey | sets only the key for the algorithm |
| SetKeyWithRounds | sets the key and rounds for the algorithm |
| SetKeyWithIV | sets the key and iv for the algorithm |
Nearly all ciphers simply use SetKeyWithIV. However, SetKey takes a NameValuePairs, so more security parameters can be set for an algorithm if needed.
SetKey (const byte *key, size_t length, const NameValuePairs ¶ms = g_nullNameValuePairs)
IV Functions
SimpleKeyingInterface provides the following functions for initialization vectors.
| Function | Comments |
|---|---|
| IVRequirement | iv requirements, such as unique or random |
| IsResynchronizable | returns true if the algorithm uses an iv |
| CanUseRandomIVs | returns true if the algorithm can use a random iv |
| CanUsePredictableIVs | returns true if the algorithm can use a predictable iv |
| CanUseStructuredIVs | returns true if the algorithm can use a structured iv |
| IVSize | iv size, in bytes |
| DefaultIVLength | minimum iv length, in bytes |
| MaxIVLength | maximum iv length, in bytes |
| DefaultIVLength | default iv length, in bytes |
| Resynchronize | sets a new iv under a key for the algorithm |
| GetNextIV | returns an iv for the algorithm |
IVRequirement returns the type of IV used by the algorithm as an IV_Requirement enumeration. The values are listed below.
| Value | Meaning |
|---|---|
| UNIQUE_IV | The IV must be unique. |
| RANDOM_IV | The IV must be random and possibly predictable. |
| UNPREDICTABLE_RANDOM_IV | The IV must be random and unpredictable. |
| INTERNALLY_GENERATED_IV | The IV is set by the object. |
| NOT_RESYNCHRONIZABLE | The object does not use an IV. |