2023-02-08 11:04:11 +00:00
|
|
|
//
|
|
|
|
// Utility.h
|
|
|
|
//
|
|
|
|
// Library: NetSSL_OpenSSL
|
|
|
|
// Package: SSLCore
|
|
|
|
// Module: Utility
|
|
|
|
//
|
|
|
|
// Definition of the Utility class.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NetSSL_Utility_INCLUDED
|
|
|
|
#define NetSSL_Utility_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
#include "Poco/Net/Context.h"
|
2023-02-13 09:22:33 +00:00
|
|
|
#include "Poco/Net/NetSSL.h"
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
namespace Net
|
|
|
|
{
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
class NetSSL_API Utility
|
|
|
|
/// This class provides various helper functions for working
|
|
|
|
/// with the OpenSSL library.
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static Context::VerificationMode convertVerificationMode(const std::string & verMode);
|
|
|
|
/// Non-case sensitive conversion of a string to a VerificationMode enum.
|
|
|
|
/// If verMode is illegal an InvalidArgumentException is thrown.
|
2023-02-08 11:04:11 +00:00
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
static std::string convertCertificateError(long errCode);
|
|
|
|
/// Converts an SSL certificate handling error code into an error message.
|
2023-02-08 11:04:11 +00:00
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
static std::string getLastError();
|
|
|
|
/// Returns the last error from the error stack
|
2023-02-08 11:04:11 +00:00
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
static void clearErrorStack();
|
|
|
|
/// Clears the error stack
|
|
|
|
};
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
|
2023-02-13 09:22:33 +00:00
|
|
|
}
|
|
|
|
} // namespace Poco::Net
|
2023-02-08 11:04:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif // NetSSL_Utility_INCLUDED
|