CipherImpl.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifndef Crypto_CipherImpl_INCLUDED
  16. #define Crypto_CipherImpl_INCLUDED
  17. #include "Poco/Crypto/Crypto.h"
  18. #include "Poco/Crypto/Cipher.h"
  19. #include "Poco/Crypto/CipherKey.h"
  20. #include "Poco/Crypto/OpenSSLInitializer.h"
  21. #include <openssl/evp.h>
  22. namespace Poco {
  23. namespace Crypto {
  24. class CipherImpl: public Cipher
  25. /// An implementation of the Cipher class for OpenSSL's crypto library.
  26. {
  27. public:
  28. CipherImpl(const CipherKey& key);
  29. /// Creates a new CipherImpl object for the given CipherKey.
  30. virtual ~CipherImpl();
  31. /// Destroys the CipherImpl.
  32. const std::string& name() const;
  33. /// Returns the name of the cipher.
  34. CryptoTransform* createEncryptor();
  35. /// Creates an encryptor object.
  36. CryptoTransform* createDecryptor();
  37. /// Creates a decryptor object.
  38. private:
  39. CipherKey _key;
  40. OpenSSLInitializer _openSSLInitializer;
  41. };
  42. //
  43. // Inlines
  44. //
  45. inline const std::string& CipherImpl::name() const
  46. {
  47. return _key.name();
  48. }
  49. } } // namespace Poco::Crypto
  50. #endif // Crypto_CipherImpl_INCLUDED