| 1 | // |
| 2 | // Utility.h |
| 3 | // |
| 4 | // Library: NetSSL_OpenSSL |
| 5 | // Package: SSLCore |
| 6 | // Module: Utility |
| 7 | // |
| 8 | // Definition of the Utility 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_Utility_INCLUDED |
| 18 | #define NetSSL_Utility_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Net/NetSSL.h" |
| 22 | #include "Poco/Net/Context.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | namespace Net { |
| 27 | |
| 28 | |
| 29 | class NetSSL_API Utility |
| 30 | /// This class provides various helper functions for working |
| 31 | /// with the OpenSSL library. |
| 32 | { |
| 33 | public: |
| 34 | static Context::VerificationMode convertVerificationMode(const std::string& verMode); |
| 35 | /// Non-case sensitive conversion of a string to a VerificationMode enum. |
| 36 | /// If verMode is illegal an InvalidArgumentException is thrown. |
| 37 | |
| 38 | static std::string convertCertificateError(long errCode); |
| 39 | /// Converts an SSL certificate handling error code into an error message. |
| 40 | |
| 41 | static std::string getLastError(); |
| 42 | /// Returns the last error from the error stack |
| 43 | |
| 44 | static void clearErrorStack(); |
| 45 | /// Clears the error stack |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | } } // namespace Poco::Net |
| 50 | |
| 51 | |
| 52 | #endif // NetSSL_Utility_INCLUDED |
| 53 | |