| 1 | // |
| 2 | // AcceptCertificateHandler.h |
| 3 | // |
| 4 | // Library: NetSSL_OpenSSL |
| 5 | // Package: SSLCore |
| 6 | // Module: AcceptCertificateHandler |
| 7 | // |
| 8 | // Definition of the AcceptCertificateHandler class. |
| 9 | // |
| 10 | // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef NetSSL_AcceptCertificateHandler_INCLUDED |
| 18 | #define NetSSL_AcceptCertificateHandler_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Net/NetSSL.h" |
| 22 | #include "Poco/Net/InvalidCertificateHandler.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | namespace Net { |
| 27 | |
| 28 | |
| 29 | class NetSSL_API AcceptCertificateHandler: public InvalidCertificateHandler |
| 30 | /// A AcceptCertificateHandler is invoked whenever an error |
| 31 | /// occurs verifying the certificate. It always accepts |
| 32 | /// the certificate. |
| 33 | /// |
| 34 | /// Should be using for testing purposes only. |
| 35 | { |
| 36 | public: |
| 37 | AcceptCertificateHandler(bool handleErrorsOnServerSide); |
| 38 | /// Creates the AcceptCertificateHandler |
| 39 | |
| 40 | virtual ~AcceptCertificateHandler(); |
| 41 | /// Destroys the AcceptCertificateHandler. |
| 42 | |
| 43 | void onInvalidCertificate(const void* pSender, VerificationErrorArgs& errorCert); |
| 44 | /// Receives the questionable certificate in parameter errorCert. If one wants to accept the |
| 45 | /// certificate, call errorCert.setIgnoreError(true). |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | } } // namespace Poco::Net |
| 50 | |
| 51 | |
| 52 | #endif // NetSSL_AcceptCertificateHandler_INCLUDED |
| 53 | |