1//
2// CipherFactory.cpp
3//
4// Library: Crypto
5// Package: Cipher
6// Module: CipherFactory
7//
8// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// SPDX-License-Identifier: BSL-1.0
12//
13
14
15#include "Poco/Crypto/CipherFactory.h"
16#include "Poco/Crypto/Cipher.h"
17#include "Poco/Crypto/CipherKey.h"
18#include "Poco/Crypto/RSAKey.h"
19#include "Poco/Crypto/CipherImpl.h"
20#include "Poco/Crypto/RSACipherImpl.h"
21#include "Poco/Exception.h"
22#include "Poco/SingletonHolder.h"
23#include <openssl/evp.h>
24#include <openssl/err.h>
25
26
27namespace Poco {
28namespace Crypto {
29
30
31CipherFactory::CipherFactory()
32{
33}
34
35
36CipherFactory::~CipherFactory()
37{
38}
39
40
41namespace
42{
43 static Poco::SingletonHolder<CipherFactory> holder;
44}
45
46
47CipherFactory& CipherFactory::defaultFactory()
48{
49 return *holder.get();
50}
51
52
53Cipher* CipherFactory::createCipher(const CipherKey& key)
54{
55 return new CipherImpl(key);
56}
57
58
59Cipher* CipherFactory::createCipher(const RSAKey& key, RSAPaddingMode paddingMode)
60{
61 return new RSACipherImpl(key, paddingMode);
62}
63
64
65} } // namespace Poco::Crypto
66