I am getting the exception as stated in the title of the question, while connecting to server using HTTPS in Java using HttpsURLConnection
class. Also I am trying to skip the certificate validation using the second last answer. Can anyone please suggest me any way out?
Update 1: Stack trace
javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
at com.kuliza.sitepulse.thread.HttpConnectionThread.run(HttpConnectionThread.java:77)
at java.lang.Thread.run(Thread.java:662)
I am getting the exception for the line of code: http.connect();
where http
is of the type HttpsURLConnection
class.
Update 2: SSL log
Here are the SSL Handshake logs:
[Raw read]: length = 5
0000: 15 03 00 00 02 .....
[Raw read]: length = 2
0000: 02 14 ..
Thread-6, READ: SSLv3 Alert, length = 2
Thread-6, RECV SSLv3 ALERT: fatal, bad_record_mac
Thread-6, called closeSocket()
Any lead please, this is driving me nuts!!
Thanks in advance!