CipherFactory.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // CipherFactory.h
  3. //
  4. // Library: Crypto
  5. // Package: Cipher
  6. // Module: CipherFactory
  7. //
  8. // Definition of the CipherFactory 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_CipherFactory_INCLUDED
  16. #define Crypto_CipherFactory_INCLUDED
  17. #include "Poco/Crypto/Crypto.h"
  18. namespace Poco {
  19. namespace Crypto {
  20. class Cipher;
  21. class CipherKey;
  22. class RSAKey;
  23. class Crypto_API CipherFactory
  24. /// A factory for Cipher objects. See the Cipher class for examples on how to
  25. /// use the CipherFactory.
  26. {
  27. public:
  28. CipherFactory();
  29. /// Creates a new CipherFactory object.
  30. virtual ~CipherFactory();
  31. /// Destroys the CipherFactory.
  32. Cipher* createCipher(const CipherKey& key);
  33. /// Creates a Cipher object for the given Cipher name. Valid cipher
  34. /// names depend on the OpenSSL version the library is linked with;
  35. /// see the output of
  36. ///
  37. /// openssl enc --help
  38. ///
  39. /// for a list of supported block and stream ciphers.
  40. ///
  41. /// Common examples are:
  42. ///
  43. /// * AES: "aes-128", "aes-256"
  44. /// * DES: "des", "des3"
  45. /// * Blowfish: "bf"
  46. Cipher* createCipher(const RSAKey& key, RSAPaddingMode paddingMode = RSA_PADDING_PKCS1);
  47. /// Creates a RSACipher using the given RSA key and padding mode
  48. /// for public key encryption/private key decryption.
  49. static CipherFactory& defaultFactory();
  50. /// Returns the default CipherFactory.
  51. private:
  52. CipherFactory(const CipherFactory&);
  53. CipherFactory& operator = (const CipherFactory&);
  54. };
  55. } } // namespace Poco::Crypto
  56. #endif // Crypto_CipherFactory_INCLUDED