1

I'm trying to use BouncyCastleProvider in order to connect with a page with the TLS1.2 certificate as follows:

public static void main(String[] args) throws Exception {
    Security.addProvider(new BouncyCastleProvider());
    final URL url = new URL("https://tls1test.salesforce.com/s/");
    final HttpsURLConnection httpsURLConnection = (HttpsURLConnection)url.openConnection();
    final InputStream inputStream = httpsURLConnection.getInputStream();
}

But I'm receiving the error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

I'm using Java version 1.6_30.

What can I do?

Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79
user1383093
  • 89
  • 1
  • 2
  • 12
  • Installing the BouncyCaste SecurityProvider enables BC for cryptographic primitives, but AFAIK not for TLS (because it is a protocol, not a crypto primitive). See http://stackoverflow.com/questions/33517476/tls-1-2-java-1-6-bouncycastle for details for to use BC for TLS. – Robert Oct 17 '16 at 14:38
  • Hi Robert, I tried the indicated code but I'm receiving the error: java.security.cert.CertificateException: Unknown cert org.bouncycastle.crypto.tls.Certificate@42552c – user1383093 Oct 17 '16 at 15:43
  • Possible duplicate of [How do I do TLS with BouncyCastle?](http://stackoverflow.com/questions/18065170/how-do-i-do-tls-with-bouncycastle) – Barend Oct 17 '16 at 16:14

0 Answers0