I have search for a day on internet but I don't have any clue to resolve my problem.
please help me.
I have register a web service on a bank, the bank send me 2 file .crt file and .key file.
And after my customer a transaction, the bank will send me a post request message to notify my server(my server receive this message), but the bank require me to send back that message to confirm via their web service url(their url use https).
when I use code java to send message back, I receive this exception
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
this this is my code
URL url = new URL("https://bankurlservice");
HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
KeyStore ksCACert = KeyStore.getInstance(KeyStore.getDefaultType());
ksCACert.load(new FileInputStream("keystore path"), "keystorepass".toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
tmf.init(ksCACert);
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
SSLSocketFactory sslSocketFactory = context.getSocketFactory();
urlConnection.setSSLSocketFactory(sslSocketFactory);
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String res = "";
String inputLine; while ((inputLine = in.readLine()) != null) { res += inputLine; } in.close();