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