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 {
111 std::string
name()
const;
269 size_t childWrittenBytes = 0)
const override;
286 void checkState() const;
291 std::unique_ptr<Impl> impl_;
bool isDecryptionMode() const
Returns true if cipher is in the decryption mode.
Padding mode: zero padding (not reversible!)
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
bool isSupportPadding() const
Returns true if cipher support padding.
bool isAuthMode() const
Returns true if cipher is configured to support authenticated encryption and decryption.
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.
size_t keyLength() const
Returns the key length of the cipher.
void asn1Read(virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader) override
Read object state from the reader.
Definition: VirgilHash.h:252
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
size_t ivSize() const
Returns the size of the cipher's IV in octets.
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:53
Padding mode: ANSI X.923 padding.
bool isEncryptionMode() const
Returns true if cipher is in the encryption mode.
virgil::crypto::VirgilByteArray finish()
Cipher finalization method.
Padding mode: PKCS7 padding (default)
VirgilByteArray iv() const
Return cipher IV, or NONCE_COUNTER for CTR-mode ciphers.
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).
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 asn1Write(virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const override
Write object state to the writer.
Cipher algorithm: AES-256, mode: CBC.
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
std::string name() const
Returns the name of the given cipher, as a string.
size_t blockSize() const
Returns the block size of the current cipher.
void clear()
Clear all configuration settings.
size_t keySize() const
Returns the key length of the cipher.
Cipher algorithm: AES-256, mode: GCM.
virgil::crypto::VirgilByteArray crypt(const virgil::crypto::VirgilByteArray &input, const virgil::crypto::VirgilByteArray &iv)
Generic all-in-one encryption / decryption.