1 // 2 // CipherImpl.h 3 // 4 // Library: Crypto 5 // Package: Cipher 6 // Module: CipherImpl 7 // 8 // Definition of the CipherImpl class. 9 // 10 // Copyright (c) 2008, Applied Informatics Software Engineering GmbH. 11 // and Contributors. 12 // 13 // SPDX-License-Identifier: BSL-1.0 14 // 15 16 17 #ifndef Crypto_CipherImpl_INCLUDED 18 #define Crypto_CipherImpl_INCLUDED 19 20 21 #include "Poco/Crypto/Crypto.h" 22 #include "Poco/Crypto/Cipher.h" 23 #include "Poco/Crypto/CipherKey.h" 24 #include "Poco/Crypto/OpenSSLInitializer.h" 25 #include <openssl/evp.h> 26 27 28 namespace Poco { 29 namespace Crypto { 30 31 32 class CipherImpl: public Cipher 33 /// An implementation of the Cipher class for OpenSSL's crypto library. 34 { 35 public: 36 CipherImpl(const CipherKey& key); 37 /// Creates a new CipherImpl object for the given CipherKey. 38 39 virtual ~CipherImpl(); 40 /// Destroys the CipherImpl. 41 42 const std::string& name() const; 43 /// Returns the name of the cipher. 44 45 CryptoTransform::Ptr createEncryptor(); 46 /// Creates an encryptor object. 47 48 CryptoTransform::Ptr createDecryptor(); 49 /// Creates a decryptor object. 50 51 private: 52 CipherKey _key; 53 OpenSSLInitializer _openSSLInitializer; 54 }; 55 56 57 // 58 // Inlines 59 // name()60inline const std::string& CipherImpl::name() const 61 { 62 return _key.name(); 63 } 64 65 66 } } // namespace Poco::Crypto 67 68 69 #endif // Crypto_CipherImpl_INCLUDED 70