mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
GH #2129: Add support for AES-GCM ciphers
This commit is contained in:
@@ -70,7 +70,11 @@ public:
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv);
|
||||
/// Creates a new CipherKeyImpl object using the given cipher
|
||||
/// name, key and initialization vector.
|
||||
/// name, key and initialization vector (IV).
|
||||
///
|
||||
/// The size of the IV must match the cipher's expected
|
||||
/// IV size (see ivSize()), except for GCM mode, which allows
|
||||
/// a custom IV size.
|
||||
|
||||
CipherKey(const std::string& name);
|
||||
/// Creates a new CipherKeyImpl object. Autoinitializes key and
|
||||
@@ -105,6 +109,10 @@ public:
|
||||
|
||||
void setIV(const ByteVec& iv);
|
||||
/// Sets the initialization vector (IV) for the Cipher.
|
||||
///
|
||||
/// The size of the vector must match the cipher's expected
|
||||
/// IV size (see ivSize()), except for GCM mode, which allows
|
||||
/// a custom IV size.
|
||||
|
||||
CipherKeyImpl::Ptr impl();
|
||||
/// Returns the impl object
|
||||
|
||||
@@ -156,13 +156,6 @@ inline const CipherKeyImpl::ByteVec& CipherKeyImpl::getIV() const
|
||||
}
|
||||
|
||||
|
||||
inline void CipherKeyImpl::setIV(const ByteVec& iv)
|
||||
{
|
||||
poco_assert(iv.size() == static_cast<ByteVec::size_type>(ivSize()));
|
||||
_iv = iv;
|
||||
}
|
||||
|
||||
|
||||
inline const EVP_CIPHER* CipherKeyImpl::cipher()
|
||||
{
|
||||
return _pCipher;
|
||||
|
||||
@@ -49,7 +49,18 @@ public:
|
||||
/// padding and the padding is checked and removed when decrypting. If the padding parameter is zero then
|
||||
/// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of
|
||||
/// the block size or an error will occur.
|
||||
|
||||
|
||||
virtual std::string getTag(std::size_t tagSize = 16) const = 0;
|
||||
/// Returns the GCM tag after encrypting using GCM mode.
|
||||
///
|
||||
/// Must be called after finalize().
|
||||
|
||||
virtual void setTag(const std::string& tag) = 0;
|
||||
/// Sets the GCM tag for authenticated decryption using GCM mode.
|
||||
///
|
||||
/// Must be set before finalize() is called, otherwise
|
||||
/// decryption will fail.
|
||||
|
||||
virtual std::streamsize transform(
|
||||
const unsigned char* input,
|
||||
std::streamsize inputLength,
|
||||
|
||||
Reference in New Issue
Block a user