Trust Anchor not found for Android SSL Connection

后端 未结 17 817
囚心锁ツ
囚心锁ツ 2020-11-22 05:06

I am trying to connect to an IIS6 box running a godaddy 256bit SSL cert, and I am getting the error :

java.security.cert.CertPathValidatorException: Trust an         


        
17条回答
  •  终归单人心
    2020-11-22 05:34

    **Set proper alias name**
    CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509","BC");
                X509Certificate cert = (X509Certificate) certificateFactory.generateCertificate(derInputStream);
                String alias = cert.getSubjectX500Principal().getName();
    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
                trustStore.load(null);
    trustStore.setCertificateEntry(alias, cert);
    

提交回复
热议问题