mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Introduce UnbufferedAsioTlsStream#GetPeerCertificate()
This commit is contained in:
parent
d1e87bdc45
commit
f2d9d91e83
@ -465,6 +465,11 @@ String UnbufferedAsioTlsStream::GetVerifyError() const
|
|||||||
return m_VerifyError;
|
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)
|
void UnbufferedAsioTlsStream::BeforeHandshake(handshake_type type)
|
||||||
{
|
{
|
||||||
namespace ssl = boost::asio::ssl;
|
namespace ssl = boost::asio::ssl;
|
||||||
|
@ -119,6 +119,7 @@ public:
|
|||||||
|
|
||||||
bool IsVerifyOK() const;
|
bool IsVerifyOK() const;
|
||||||
String GetVerifyError() const;
|
String GetVerifyError() const;
|
||||||
|
std::shared_ptr<X509> GetPeerCertificate();
|
||||||
|
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
inline
|
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;
|
bool verify_ok = false;
|
||||||
String identity;
|
String identity;
|
||||||
Endpoint::Ptr endpoint;
|
Endpoint::Ptr endpoint;
|
||||||
|
@ -34,7 +34,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona
|
|||||||
/* Use the presented client certificate if not provided. */
|
/* Use the presented client certificate if not provided. */
|
||||||
if (certText.IsEmpty()) {
|
if (certText.IsEmpty()) {
|
||||||
auto stream (origin->FromClient->GetStream());
|
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 {
|
} else {
|
||||||
cert = StringToCertificate(certText);
|
cert = StringToCertificate(certText);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user