Abstract interface of block ciphers. More...
Public Member Functions | |
virtual | ~BlockCipher () |
Virtual destructor. | |
virtual size_t | blockSize () const =0 |
Size in bytes of the block used by the algorithm. More... | |
virtual bool | decrypt (const void *cipher, size_t cipher_length, void *plain, size_t plain_maxsize, size_t *plain_length=nullptr)=0 |
Decrypt one block of data. More... | |
virtual bool | decryptInPlace (void *data, size_t data_length, size_t *max_actual_length=nullptr) |
Decrypt one block of data in place. More... | |
virtual size_t | defaultRounds () const =0 |
Default number of rounds for the algorithm. More... | |
virtual bool | encrypt (const void *plain, size_t plain_length, void *cipher, size_t cipher_maxsize, size_t *cipher_length=nullptr)=0 |
Encrypt one block of data. More... | |
virtual bool | encryptInPlace (void *data, size_t data_length, size_t *max_actual_length=nullptr) |
Encrypt one block of data in place. More... | |
virtual bool | isValidKeySize (size_t size) const =0 |
Check if a size in bytes is a valid key size. More... | |
virtual size_t | maxKeySize () const =0 |
Maximum key sizes in bytes. More... | |
virtual size_t | maxRounds () const =0 |
Maximum number of rounds for the algorithm. More... | |
virtual size_t | minKeySize () const =0 |
Minimum key sizes in bytes. More... | |
virtual size_t | minRounds () const =0 |
Minimum number of rounds for the algorithm. More... | |
virtual UString | name () const =0 |
Algorithm name (informational only). More... | |
virtual bool | setKey (const void *key, size_t key_length, size_t rounds=0)=0 |
Schedule a new key. More... | |
Abstract interface of block ciphers.
|
pure virtual |
Algorithm name (informational only).
Implemented in ts::DVBCSA2, ts::DVS042< CIPHER >, ts::DVS042< AES >, ts::DVS042< DES >, ts::SCTE52_2008, ts::CTS1< CIPHER >, ts::CTS3< CIPHER >, ts::CTS2< CIPHER >, ts::CTS4< CIPHER >, ts::CBC< CIPHER >, ts::ECB< CIPHER >, ts::SCTE52_2003, ts::IDSA, ts::AES, ts::DES, and ts::TDES.
|
pure virtual |
Size in bytes of the block used by the algorithm.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Minimum key sizes in bytes.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Maximum key sizes in bytes.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Check if a size in bytes is a valid key size.
[in] | size | Suggested key size in bytes. |
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Minimum number of rounds for the algorithm.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Maximum number of rounds for the algorithm.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Default number of rounds for the algorithm.
Implemented in ts::DVBCSA2, ts::AES, ts::CipherChaining, ts::DES, and ts::TDES.
|
pure virtual |
Schedule a new key.
[in] | key | Address of key value. |
[in] | key_length | Key length in bytes. |
[in] | rounds | Requested number of rounds. If zero, the default is used. |
Implemented in ts::DVBCSA2, ts::AES, ts::DES, ts::TDES, and ts::CipherChaining.
|
pure virtual |
Encrypt one block of data.
For pure block ciphers such as AES or DES, the plain text and cipher text must have the block size of the algorithm. For cipher chainings, the acceptable message sizes depend on the chaining mode.
[in] | plain | Address of plain text. |
[in] | plain_length | Plain text length in bytes. |
[out] | cipher | Address of buffer for cipher text. |
[in] | cipher_maxsize | Size of cipher buffer. |
[out] | cipher_length | Returned actual size of cipher text. Ignored if zero. |
Implemented in ts::DVBCSA2, ts::DVS042< CIPHER >, ts::DVS042< AES >, ts::DVS042< DES >, ts::CTS1< CIPHER >, ts::CTS3< CIPHER >, ts::CTS2< CIPHER >, ts::CTS4< CIPHER >, ts::AES, ts::CBC< CIPHER >, ts::ECB< CIPHER >, ts::DES, and ts::TDES.
|
pure virtual |
Decrypt one block of data.
For pure block ciphers such as AES or DES, the plain text and cipher text must have the block size of the algorithm. For cipher chainings, the acceptable message sizes depend on the chaining mode.
[in] | cipher | Address of cipher text. |
[in] | cipher_length | Cipher text length in bytes. |
[out] | plain | Address of buffer for plain text. |
[in] | plain_maxsize | Size of plain buffer. |
[out] | plain_length | Returned actual size of plain text. Ignored if zero. |
Implemented in ts::DVBCSA2, ts::DVS042< CIPHER >, ts::DVS042< AES >, ts::DVS042< DES >, ts::CTS1< CIPHER >, ts::CTS3< CIPHER >, ts::CTS2< CIPHER >, ts::CTS4< CIPHER >, ts::AES, ts::CBC< CIPHER >, ts::ECB< CIPHER >, ts::DES, and ts::TDES.
|
virtual |
Encrypt one block of data in place.
The default implementation is to call encrypt() and copy the data. A subclass may provide a more efficient implementation.
For pure block ciphers such as AES or DES, the plain text and cipher text must have the block size of the algorithm. For cipher chainings, the acceptable message sizes depend on the chaining mode.
[in,out] | data | Address of data buffer to encrypt. |
[in] | data_length | Input plain text length in bytes. |
[in,out] | max_actual_length | Optional, ignored if zero. On input, contain the maximum size of the data buffer, which can be larger than data_length. On output, receive the actual size of the encrypted data. For pure block ciphers, this is the same as data_length. For cipher chainings with padding, this can be larger. |
Reimplemented in ts::DVBCSA2.
|
virtual |
Decrypt one block of data in place.
The default implementation is to call decrypt() and copy the data. A subclass may provide a more efficient implementation.
For pure block ciphers such as AES or DES, the plain text and cipher text must have the block size of the algorithm. For cipher chainings, the acceptable message sizes depend on the chaining mode.
[in,out] | data | Address of data buffer to decrypt. |
[in] | data_length | Input cipher text length in bytes. |
[in,out] | max_actual_length | Optional, ignored if zero. On input, contain the maximum size of the data buffer, which can be larger than data_length. On output, receive the actual size of the decrypted data. For pure block ciphers, this is the same as data_length. For cipher chainings with padding, this can be smaller. |
Reimplemented in ts::DVBCSA2.