Search in sources :

Example 1 with RenegotiationRequiredException

use of io.undertow.server.RenegotiationRequiredException in project undertow by undertow-io.

the class SslClientCertAttribute method readAttribute.

@Override
public String readAttribute(HttpServerExchange exchange) {
    SSLSessionInfo ssl = exchange.getConnection().getSslSessionInfo();
    if (ssl == null) {
        return null;
    }
    Certificate[] certificates;
    try {
        certificates = ssl.getPeerCertificates();
        if (certificates.length > 0) {
            return Certificates.toPem(certificates[0]);
        }
        return null;
    } catch (SSLPeerUnverifiedException | CertificateEncodingException | RenegotiationRequiredException e) {
        return null;
    }
}
Also used : SSLSessionInfo(io.undertow.server.SSLSessionInfo) SSLPeerUnverifiedException(javax.net.ssl.SSLPeerUnverifiedException) CertificateEncodingException(java.security.cert.CertificateEncodingException) Certificate(java.security.cert.Certificate) RenegotiationRequiredException(io.undertow.server.RenegotiationRequiredException)

Aggregations

RenegotiationRequiredException (io.undertow.server.RenegotiationRequiredException)1 SSLSessionInfo (io.undertow.server.SSLSessionInfo)1 Certificate (java.security.cert.Certificate)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1 SSLPeerUnverifiedException (javax.net.ssl.SSLPeerUnverifiedException)1