java - Trusting an expired certificate -


this question has answer here:

my client failing below error while communicating https server expired cert. while in process of waiting fixed on server side renewing, wondering if can pass error adding expired cert our own trust store? allows gain testing time while waiting cert renewed.

us has end date thu sep 08 19:59:59 edt 2011 no longer valid. [4/17/13 19:22:55:618 edt] 00000021 systemout     o   webcontainer : 0, send tlsv1 alert:  fatal, description = certificate_unknown [4/17/13 19:22:55:620 edt] 00000021 systemout     o   webcontainer : 0, write: tlsv1 alert, length = 2 [4/17/13 19:22:55:620 edt] 00000021 systemout     o   webcontainer : 0, called closesocket() [4/17/13 19:22:55:620 edt] 00000021 systemout     o   webcontainer : 0, handling exception: javax.net.ssl.sslhandshakeexception: com.ibm.jsse2.util.g: pkix path building failed: java.security.cert.certpathbuilderexception: pkixcertpathbuilderimpl not build valid certpath.; internal cause is:      java.security.cert.certpathvalidatorexception: certificate issued cn=thawte ssl ca, o="thawte, inc.", c=us not trusted; internal cause is:  

use following code trust certificates. note: not use in production

    try {         sslcontext ctx = sslcontext.getinstance("tls");         ctx.init(new keymanager[0], new trustmanager[] { new x509trustmanager() {             @override             public void checkclienttrusted(x509certificate[] x509certificates, string name) throws certificateexception {}              @override             public void checkservertrusted(x509certificate[] x509certificates, string name) throws certificateexception {}              @override             public x509certificate[] getacceptedissuers() {                 return null;             }         } }, new securerandom());          sslcontext.setdefault(ctx);     } catch (exception e) {         throw new runtimeexception(e);     } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -