37 #ifndef VIRGIL_CRYPTO_SYMMETRIC_SIPHER_H 38 #define VIRGIL_CRYPTO_SYMMETRIC_SIPHER_H 43 #include <virgil/crypto/VirgilByteArray.h> 44 #include <virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h> 46 namespace virgil {
namespace crypto {
namespace foundation {
113 std::string
name()
const;
271 size_t childWrittenBytes = 0)
const override;
288 void checkState()
const;
293 std::unique_ptr<Impl> impl_;
Padding mode: zero padding (not reversible!)
std::string name() const
Returns the name of the given cipher, as a string.
void setIV(const virgil::crypto::VirgilByteArray &iv)
Configures the initialization vector.
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
Algorithm
Definition: VirgilSymmetricCipher.h:72
size_t asn1Write(virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const override
Write object state to the writer.
bool isEncryptionMode() const
Returns true if cipher is in the encryption mode.
This class provides interface that allow to save and restore object state in the ASN.1 structure.
Definition: VirgilAsn1Compatible.h:59
Padding mode: ISO/IEC 7816-4 padding.
void asn1Read(virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader) override
Read object state from the reader.
Definition: VirgilHash.h:265
This class provides methods for writing ASN.1 data structure.
Definition: VirgilAsn1Writer.h:54
void setPadding(VirgilSymmetricCipher::Padding padding)
Defines padding mode.
Root namespace for all Virgil Security libraries.
Definition: VirgilAsn1Compatible.h:46
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:54
Padding mode: ANSI X.923 padding.
size_t keyLength() const
Returns the key length of the cipher.
virgil::crypto::VirgilByteArray finish()
Cipher finalization method.
Padding mode: PKCS7 padding (default)
VirgilSymmetricCipher()
Create object with undefined algorithm.
void setDecryptionKey(const virgil::crypto::VirgilByteArray &key)
Configures decryption key.
size_t authTagLength() const
Returns the authentication tag length of the cipher.
void setAuthData(const virgil::crypto::VirgilByteArray &authData)
Add additional data (for AEAD ciphers).
bool isAuthMode() const
Returns true if cipher is configured to support authenticated encryption and decryption.
Padding
Padding modes for the symmetric cipher.
Definition: VirgilSymmetricCipher.h:61
string to_string(virgil::crypto::foundation::VirgilSymmetricCipher::Algorithm alg)
Returns string representation of the Hash algorithm.
void reset()
Finish preparation before encryption / decryption.
Padding mode: never pad (full blocks only)
size_t keySize() const
Returns the key length of the cipher.
bool isDecryptionMode() const
Returns true if cipher is in the decryption mode.
VirgilByteArray iv() const
Return cipher IV, or NONCE_COUNTER for CTR-mode ciphers.
void setEncryptionKey(const virgil::crypto::VirgilByteArray &key)
Configures encryption key.
virgil::crypto::VirgilByteArray update(const virgil::crypto::VirgilByteArray &input)
Generic cipher update function.
Provides symmetric ciphers algorithms.
Definition: VirgilSymmetricCipher.h:52
size_t ivSize() const
Returns the size of the cipher's IV in octets.
bool isSupportPadding() const
Returns true if cipher support padding.
void clear()
Clear all configuration settings.
size_t blockSize() const
Returns the block size of the current cipher.
virgil::crypto::VirgilByteArray crypt(const virgil::crypto::VirgilByteArray &input, const virgil::crypto::VirgilByteArray &iv)
Generic all-in-one encryption / decryption.