mirror of https://github.com/Icinga/icinga2.git
Introduce UnbufferedAsioTlsStream#GetPeerCertificate()
This commit is contained in:
parent
d1e87bdc45
commit
f2d9d91e83
|
@ -465,6 +465,11 @@ String UnbufferedAsioTlsStream::GetVerifyError() const
|
|||
return m_VerifyError;
|
||||
}
|
||||
|
||||
std::shared_ptr<X509> UnbufferedAsioTlsStream::GetPeerCertificate()
|
||||
{
|
||||
return std::shared_ptr<X509>(SSL_get_peer_certificate(native_handle()), X509_free);
|
||||
}
|
||||
|
||||
void UnbufferedAsioTlsStream::BeforeHandshake(handshake_type type)
|
||||
{
|
||||
namespace ssl = boost::asio::ssl;
|
||||
|
|
|
@ -119,6 +119,7 @@ public:
|
|||
|
||||
bool IsVerifyOK() const;
|
||||
String GetVerifyError() const;
|
||||
std::shared_ptr<X509> GetPeerCertificate();
|
||||
|
||||
template<class... Args>
|
||||
inline
|
||||
|
|
|
@ -523,7 +523,7 @@ void ApiListener::NewClientHandlerInternal(boost::asio::yield_context yc, const
|
|||
}
|
||||
});
|
||||
|
||||
std::shared_ptr<X509> cert (SSL_get_peer_certificate(sslConn.native_handle()), X509_free);
|
||||
std::shared_ptr<X509> cert (sslConn.GetPeerCertificate());
|
||||
bool verify_ok = false;
|
||||
String identity;
|
||||
Endpoint::Ptr endpoint;
|
||||
|
|
|
@ -34,7 +34,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona
|
|||
/* Use the presented client certificate if not provided. */
|
||||
if (certText.IsEmpty()) {
|
||||
auto stream (origin->FromClient->GetStream());
|
||||
cert = std::shared_ptr<X509>(SSL_get_peer_certificate(stream->next_layer().native_handle()), X509_free);
|
||||
cert = stream->next_layer().GetPeerCertificate();
|
||||
} else {
|
||||
cert = StringToCertificate(certText);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue