mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
b79ead9c84
* Replicate poco into base/poco/ * De-register poco submodule * Build poco from ClickHouse * Exclude poco from stylecheck * Exclude poco from whitespace check * Exclude poco from typo check * Remove x bit from sources/headers (the style check complained) * Exclude poco from duplicate include check * Fix fasttest * Remove contrib/poco-cmake/* * Simplify poco build descriptions * Remove poco stuff not used by ClickHouse * Glob poco sources * Exclude poco from clang-tidy
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
//
|
|
// ConsoleCertificateHandler.cpp
|
|
//
|
|
// Library: NetSSL_OpenSSL
|
|
// Package: SSLCore
|
|
// Module: ConsoleCertificateHandler
|
|
//
|
|
// Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#include "Poco/Net/ConsoleCertificateHandler.h"
|
|
#include <iostream>
|
|
|
|
|
|
namespace Poco {
|
|
namespace Net {
|
|
|
|
|
|
ConsoleCertificateHandler::ConsoleCertificateHandler(bool server): InvalidCertificateHandler(server)
|
|
{
|
|
}
|
|
|
|
|
|
ConsoleCertificateHandler::~ConsoleCertificateHandler()
|
|
{
|
|
}
|
|
|
|
|
|
void ConsoleCertificateHandler::onInvalidCertificate(const void*, VerificationErrorArgs& errorCert)
|
|
{
|
|
const X509Certificate& aCert = errorCert.certificate();
|
|
std::cout << "\n";
|
|
std::cout << "WARNING: Certificate verification failed\n";
|
|
std::cout << "----------------------------------------\n";
|
|
std::cout << "Issuer Name: " << aCert.issuerName() << "\n";
|
|
std::cout << "Subject Name: " << aCert.subjectName() << "\n\n";
|
|
std::cout << "The certificate yielded the error: " << errorCert.errorMessage() << "\n\n";
|
|
std::cout << "The error occurred in the certificate chain at position " << errorCert.errorDepth() << "\n";
|
|
std::cout << "Accept the certificate (y,n)? ";
|
|
char c = 0;
|
|
std::cin >> c;
|
|
if (c == 'y' || c == 'Y')
|
|
errorCert.setIgnoreError(true);
|
|
else
|
|
errorCert.setIgnoreError(false);
|
|
}
|
|
|
|
|
|
} } // namespace Poco::Net
|