1 | // |
2 | // ECKey.cpp |
3 | // |
4 | // |
5 | // Library: Crypto |
6 | // Package: EC |
7 | // Module: ECKey |
8 | // |
9 | // Copyright (c) 2008, Applied Informatics Software Engineering GmbH. |
10 | // and Contributors. |
11 | // |
12 | // SPDX-License-Identifier: BSL-1.0 |
13 | // |
14 | |
15 | |
16 | #include "Poco/Crypto/ECKey.h" |
17 | #include <openssl/rsa.h> |
18 | |
19 | |
20 | namespace Poco { |
21 | namespace Crypto { |
22 | |
23 | |
24 | ECKey::ECKey(const EVPPKey& key): |
25 | KeyPair(new ECKeyImpl(key)), |
26 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
27 | { |
28 | } |
29 | |
30 | |
31 | ECKey::ECKey(const X509Certificate& cert): |
32 | KeyPair(new ECKeyImpl(cert)), |
33 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
34 | { |
35 | } |
36 | |
37 | |
38 | ECKey::ECKey(const PKCS12Container& cont): |
39 | KeyPair(new ECKeyImpl(cont)), |
40 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
41 | { |
42 | } |
43 | |
44 | |
45 | ECKey::ECKey(const std::string& eccGroup): |
46 | KeyPair(new ECKeyImpl(OBJ_txt2nid(eccGroup.c_str()))), |
47 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
48 | { |
49 | } |
50 | |
51 | |
52 | ECKey::ECKey(const std::string& publicKeyFile, |
53 | const std::string& privateKeyFile, |
54 | const std::string& privateKeyPassphrase): |
55 | KeyPair(new ECKeyImpl(publicKeyFile, privateKeyFile, privateKeyPassphrase)), |
56 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
57 | { |
58 | } |
59 | |
60 | |
61 | ECKey::ECKey(std::istream* pPublicKeyStream, |
62 | std::istream* pPrivateKeyStream, |
63 | const std::string& privateKeyPassphrase): |
64 | KeyPair(new ECKeyImpl(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase)), |
65 | _pImpl(KeyPair::impl().cast<ECKeyImpl>()) |
66 | { |
67 | } |
68 | |
69 | |
70 | ECKey::~ECKey() |
71 | { |
72 | } |
73 | |
74 | |
75 | } } // namespace Poco::Crypto |
76 | |