37 #ifndef VIRGIL_CRYPTO_VIRGIL_SYMMETRIC_CIPHER_H 38 #define VIRGIL_CRYPTO_VIRGIL_SYMMETRIC_CIPHER_H 40 #include "../VirgilByteArray.h" 44 namespace virgil {
namespace crypto {
inline namespace primitive {
69 return self_->doGetKeySize();
77 return self_->doGetNonceSize();
93 return self_->doEncrypt(plainText, key, nonce, authData);
109 return self_->doDecrypt(cipherText, key, nonce, authData);
119 virtual size_t doGetKeySize()
const = 0;
121 virtual size_t doGetNonceSize()
const = 0;
131 virtual ~Concept() noexcept =
default;
135 struct Model : Concept {
137 explicit Model(Impl impl) : impl_(std::move(impl)) {}
139 size_t doGetKeySize()
const override {
140 return impl_.getKeySize();
143 size_t doGetNonceSize()
const override {
144 return impl_.getNonceSize();
150 return impl_.encrypt(plainText, key, nonce, authData);
156 return impl_.decrypt(plainText, key, nonce, authData);
163 std::shared_ptr<const Concept> self_;
168 #endif //VIRGIL_CRYPTO_VIRGIL_SYMMETRIC_CIPHER_H size_t getNonceSize() const
Return size of the nonce.
Definition: VirgilOperationCipher.h:76
static VirgilOperationCipher getDefault()
Return default implementation.
Define proxy interface for the Symmetric Cipher functionality.
Definition: VirgilOperationCipher.h:51
Definition: VirgilHash.h:265
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:50
VirgilByteArray encrypt(const VirgilByteArray &plainText, const VirgilByteArray &key, const VirgilByteArray &nonce, const VirgilByteArray &authData=VirgilByteArray()) const
Encrypt given plain text.
Definition: VirgilOperationCipher.h:89
size_t getKeySize() const
Return size of the encryption/decryption key.
Definition: VirgilOperationCipher.h:68
VirgilByteArray decrypt(const VirgilByteArray &cipherText, const VirgilByteArray &key, const VirgilByteArray &nonce, const VirgilByteArray &authData=VirgilByteArray()) const
Decrypt given cipher text.
Definition: VirgilOperationCipher.h:105
VirgilOperationCipher(Impl impl)
Captures implementation object.
Definition: VirgilOperationCipher.h:62