go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Error #5 SSLServerSocket.setWantClientAuth(boolean want) may drop connection
 
Subject: Error #5 SSLServerSocket.setWantClientAuth(boolean want) may drop connection
Author: authen
In response to: Error #4 SignatureException: Signature does not match
Posted on: 01/29/2010 02:55:43 PM

void javax.net.ssl.SSLServerSocket.setWantClientAuth(boolean want)

public abstract void setWantClientAuth(boolean want)

Controls whether accepted server-mode SSLSockets will be initially configured 
to request client authentication. 

A socket's client authentication setting is one of the following: 
  • client authentication required
  • client authentication requested
  • no client authentication desired Unlike setNeedClientAuth(boolean), if the accepted socket's option is set and the client chooses not to provide authentication information about itself, the negotiations will continue. Calling this method overrides any previous setting made by this method or setNeedClientAuth(boolean). The initial inherited setting may be overridden by calling SSLSocket.setNeedClientAuth(boolean) or SSLSocket.setWantClientAuth(boolean). Parameters: want - set to true if client authentication is requested, or false if no client authentication is desired. See Also: getWantClientAuth(), setNeedClientAuth(boolean), getNeedClientAuth(), setUseClientMode(boolean)



  • But if the accepted socket's option is set,some clients like Microsoft's LDP.exe DID choose to provide authentication information about itself, even the client certificate was expired, if the certificate is good the negotiations will continue; but if the certificate is not good the negotiations will drop.



    Here is the error message got on the client (LDP.exe) side:
    
    ld = ldap_sslinit("myLDAPServer", 636, 1);
    Error <0x0> = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, LDAP_VERSION3);
    Error <0x51> = ldap_connect(hLdap, NULL);
    Server error: <empty>
    Error <0x51>: Fail to connect to myLDAPServer.
    





    Here is the error message got on the server side:
    
    javax.net.ssl.SSLHandshakeException:  General SSLEngine problem 
    	at com.sun.net.ssl.internal.ssl.Handshaker.checkThrown(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.SSLEngineImpl.checkTaskThrown(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.SSLEngineImpl.writeAppRecord(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.SSLEngineImpl.wrap(Unknown Source)
    	at javax.net.ssl.SSLEngine.wrap(Unknown Source)
    Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.ServerHandshaker.clientCertificate(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.ServerHandshaker.processMessage(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.Handshaker$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.net.ssl.internal.ssl.Handshaker$DelegatedTask.run(Unknown Source)
    	... 6 more
    Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: 
    java.security.cert.CertPathValidatorException: timestamp check failed
    	at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
    	at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
    	at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    	at sun.security.validator.Validator.validate(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkClientTrusted(Unknown Source)
    	at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkClientTrusted(Unknown Source)
    	... 14 more
    Caused by: java.security.cert.CertPathValidatorException:  timestamp check failed
    	at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(Unknown Source)
    	at sun.security.provider.certpath.PKIXCertPathValidator.doValidate(Unknown Source)
    	at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(Unknown Source)
    	at java.security.cert.CertPathValidator.validate(Unknown Source)
    	... 21 more
    Caused by: java.security.cert.CertificateExpiredException: NotAfter: Fri Mar 20 09:32:16 PST 2009 
    	at sun.security.x509.CertificateValidity.valid(Unknown Source)
    	at sun.security.x509.X509CertImpl.checkValidity(Unknown Source)
    	at sun.security.provider.certpath.BasicChecker.verifyTimestamp(Unknown Source)
    	at sun.security.provider.certpath.BasicChecker.check(Unknown Source)
    	... 25 more
    





     

    > On 12/02/2009 05:50:41 PM authen wrote:

    On the client side, the JNDI application requests SSL connection by ClientHello and then get the connected server's certificate within ServerHello. If the client's trust store is obselete (not expired but just old version for example), the signature checking may prevent client connecting the newly updated server. The errors (on client side) may look like this:

    :
    java.security.SignatureException: Signature does not match.
    at sun.security.x509.X509CertImpl.verify(X509CertImpl.java:446)
    at sun.security.provider.certpath.BasicChecker.verifySignature(BasicChecker.java:133)
    at sun.security.provider.certpath.BasicChecker.check(BasicChecker.java:112)
    at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:117)
    at sun.security.provider.certpath.PKIXCertPathValidator.doValidate(PKIXCertPathValidator.java:316)
    at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:178)
    at java.security.cert.CertPathValidator.validate(CertPathValidator.java:250)
    at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:246)
    at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:234)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:158)
    at sun.security.validator.Validator.validate(Validator.java:218)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:199)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:239)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:840)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:111)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:509)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:447)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:822)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1034)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:626)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:393)
    at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:334)
    at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:192)
    at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2658)
    at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:287)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)


    The PKIX validation process is:


    certpath: PKIXCertPathValidator.engineValidate()...
    certpath: PKIXCertPathValidator.engineValidate() reversing certpath...
    certpath: PKIXCertPathValidator.engineValidate() anchor.getTrustedCert() != null
    certpath: PKIXCertPathValidator.isWorthTrying() checking if this trusted cert is worth trying ...
    certpath: NO - don't try this trustedCert
    certpath: PKIXCertPathValidator.engineValidate() anchor.getTrustedCert() != null
    certpath: PKIXCertPathValidator.isWorthTrying() checking if this trusted cert is worth trying ...
    certpath: YES - try this trustedCert
    certpath: anchor.getTrustedCert().getSubjectX500Principal() = CN=myAD,DC=myCompany, DC=com
    certpath: --------------------------------------------------------------
    certpath: Executing PKIX certification path validation algorithm.
    certpath: Checking cert1 ...
    certpath: -Using checker1 ... [sun.security.provider.certpath.KeyChecker]
    certpath: -checker1 validation succeeded
    certpath: -Using checker2 ... [sun.security.provider.certpath.ConstraintsChecker]
    certpath: ---checking basic constraints...
    certpath: i = 1
    certpath: maxPathLength = 1
    certpath: after processing, maxPathLength = 1
    certpath: basic constraints verified.
    certpath: ---checking name constraints...
    certpath: prevNC = null
    certpath: newNC = null
    certpath: mergedNC = null
    certpath: name constraints verified.
    certpath: -checker2 validation succeeded
    certpath: -Using checker3 ... [sun.security.provider.certpath.PolicyChecker]
    certpath: PolicyChecker.checkPolicy() ---checking certificate policies...
    certpath: PolicyChecker.checkPolicy() certIndex = 1
    certpath: PolicyChecker.checkPolicy() BEFORE PROCESSING: explicitPolicy = 2
    certpath: PolicyChecker.checkPolicy() BEFORE PROCESSING: policyMapping = 2
    certpath: PolicyChecker.checkPolicy() BEFORE PROCESSING: inhibitAnyPolicy = 2
    certpath: PolicyChecker.checkPolicy() BEFORE PROCESSING: policyTree = anyPolicy ROOT

    certpath: PolicyChecker.processPolicies() no policies present in cert
    certpath: PolicyChecker.checkPolicy() AFTER PROCESSING: explicitPolicy = 2
    certpath: PolicyChecker.checkPolicy() AFTER PROCESSING: policyMapping = 2
    certpath: PolicyChecker.checkPolicy() AFTER PROCESSING: inhibitAnyPolicy = 2
    certpath: PolicyChecker.checkPolicy() AFTER PROCESSING: policyTree = null
    certpath: PolicyChecker.checkPolicy() certificate policies verified
    certpath: -checker3 validation succeeded
    certpath: -Using checker4 ... [sun.security.provider.certpath.BasicChecker]
    certpath: ---checking timestamp:Wed Dec 25 12:39:16 PST 2008...
    certpath: timestamp verified.
    certpath: ---checking subject/issuer name chaining...
    certpath: subject/issuer name chaining verified.
    certpath: ---checking signature...
    certpath: Signature does not match.






    References:

     


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.