cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakub Neubauer (JIRA)" <>
Subject [jira] [Commented] (CXF-5525) Client - UntrustedURLConnectionIOException even the HTTPS established with client certificate auth
Date Thu, 24 Apr 2014 10:43:14 GMT


Jakub Neubauer commented on CXF-5525:

Problem is that client certificate verification is done by IIS in later time, not at the beginning
of the SSL communication. I'll try do describe the communication:
# SSL Handshake is done between client and IIS server, but first WITHOUT client certificate
# Client sends the HTTP request (at least the header, where URL is specified).
# IIS server recognizes the requested URL and re-initiates the SSL handshake (with SSL message
Change_cipher_spec). It works in this way because in IIS you can specify different SSL behaviour
for different URLs. So for example, for one endpoint you can configure SSL without client
certificate and for second endpoint WITH client certificate.
# During the second SSL handshake, the client certificate is requested by IIS server and verified.
# Then the rest of request is processed by IIS server.

Problem is, that CXF client doesn't count with this behaviour. If certificate authentication
is configured in WSDL, the CXF client performs a check that the client certificate was sent
during the handshake (in one of the CXF phases - org.apache.cxf.phase.Phase). But it is done
just after the FIRST handshake. This check by CXF client is done yet before the request data
are sent, it is performed after just the first SSL handshake. But as I described, the first
handshake is without client certificate. The certificate is requested by IIS server in second
handshake, after URL is known to the IIS server. But CXF client never comes to this point,
since it fails on the check after the first handshake - as is seen from the exception stacktrace.

So, I suggest not doing the check that client certificate was requested by the server - after
all, it is the SERVER responsibility to check the certificate - why should the CXF client
care about it?
It means removing the code in the, somewhere around line

if (info.getLocalCertificates() == null || info.getLocalCertificates().length == 0) {
  throw new UntrustedURLConnectionIOException( "RequireClientCertificate is set, "
    + "but no local certificates were negotiated.  Is"
    + " the server set to ask for client authorization?");

> Client - UntrustedURLConnectionIOException even the HTTPS established with client certificate
> --------------------------------------------------------------------------------------------------
>                 Key: CXF-5525
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>         Environment: java 1.6.0_45 and 1.7.0_45 on Windows 8, CXF version 2.7.6
>            Reporter: Jakub Neubauer
> Hi,
> I'm facing issue with CXF client. I have a Java client generated from WSDL. The WSDL
contains RequireClientCertificate="true" in the Policy. I'm calling a web service over HTTPS
with client certificate authentication. Although HTTPS connection is established and with
client certificate authentication (ensured with, calling a WS method
throws exception.
> The strange thing is, that the first call succeeded and the second and all other calls,
fail with this exception (!). The other calls can be done with the same client object or can
create new, no matter. The client object is created as follows:
> {code}
> // our custom ssl settings, with client cert auth in this case.
> SSLSocketFactory sslSockF =
> createSSLSocketFactoryFromProperties(_properties);
> ProductionService service = new ProductionService(
>          new URL(myURL),
>          new QName("",
> "ProductionService"));
> port = service.getBasicHttpBindingIProductionService();
> Client client = ClientProxy.getClient(port);
> HTTPConduit http = (HTTPConduit) client.getConduit();
> TLSClientParameters tlsParams = new TLSClientParameters();
> tlsParams.setDisableCNCheck(true);
> tlsParams.setSSLSocketFactory(sslSockF);
> http.setTlsClientParameters(tlsParams);
> return port;
> {code}
> The exception:
> {noformat}
> -----------------------------
> etc...
> Caused by: org.apache.cxf.transport.http.UntrustedURLConnectionIOException: UntrustedURLConnectionIOException
invoking RequireClientCertificate
is set, but no local certificates were negotiated.  Is the server set to ask for client authorization?
>  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
>  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
>  at java.lang.reflect.Constructor.newInstance(Unknown Source)
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(
>  at org.apache.cxf.transport.AbstractConduit.close(
>  at org.apache.cxf.transport.http.HTTPConduit.close(
>  at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(
>  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>  at org.apache.cxf.endpoint.ClientImpl.doInvoke(
>  at org.apache.cxf.endpoint.ClientImpl.invoke(
>  at org.apache.cxf.endpoint.ClientImpl.invoke(
>  at org.apache.cxf.endpoint.ClientImpl.invoke(
>  at org.apache.cxf.frontend.ClientProxy.invokeSync(
>  at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(
>  ... 14 more
> Caused by: org.apache.cxf.transport.http.UntrustedURLConnectionIOException: RequireClientCertificate
is set, but no local certificates were negotiated.  Is the server set to ask for client authorization?
>  at$HttpsTokenOutInterceptor$1.establishTrust(
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.makeTrustDecision(
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(
>  at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(
>  at
>  at
>  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(
>  ... 24 more
> -----------------------------
> {noformat}

This message was sent by Atlassian JIRA

View raw message