1 | // |
---|---|
2 | // PrivateKeyPassphraseHandler.cpp |
3 | // |
4 | // Library: NetSSL_OpenSSL |
5 | // Package: SSLCore |
6 | // Module: PrivateKeyPassphraseHandler |
7 | // |
8 | // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH. |
9 | // and Contributors. |
10 | // |
11 | // SPDX-License-Identifier: BSL-1.0 |
12 | // |
13 | |
14 | |
15 | #include "Poco/Net/PrivateKeyPassphraseHandler.h" |
16 | #include "Poco/Net/SSLManager.h" |
17 | #include "Poco/Delegate.h" |
18 | |
19 | |
20 | using Poco::Delegate; |
21 | |
22 | |
23 | namespace Poco { |
24 | namespace Net { |
25 | |
26 | |
27 | PrivateKeyPassphraseHandler::PrivateKeyPassphraseHandler(bool onServerSide): _serverSide(onServerSide) |
28 | { |
29 | SSLManager::instance().PrivateKeyPassphraseRequired += Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested); |
30 | } |
31 | |
32 | |
33 | PrivateKeyPassphraseHandler::~PrivateKeyPassphraseHandler() |
34 | { |
35 | try |
36 | { |
37 | SSLManager::instance().PrivateKeyPassphraseRequired -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested); |
38 | } |
39 | catch (...) |
40 | { |
41 | poco_unexpected(); |
42 | } |
43 | } |
44 | |
45 | |
46 | } } // namespace Poco::Net |
47 |