2

I am using the RestAssured library to make calls to certain REST API's

These are https endpoints and I tried using the "relaxedHTTPSValidation()" method provided in RestAssured to bypass SSL validation

My request looks something like

RequestSpecification req = RestAssured.given().relaxedHTTPSValidation().body().post(); 

I keep getting the error

javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
    at    sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)

Doeas anyone have an idea why this is happening ?

sam
  • 568
  • 1
  • 8
  • 16
  • Is your URL public so that I can try it out? – Johan Aug 15 '15 at 14:37
  • An alternative way to do this is to add the cert of the hostname to the trust store.. cacerts or jssecerts. – sunshine Oct 08 '16 at 01:50
  • There can be many reasons- check this link if that helps https://stackoverflow.com/questions/30350120/sslhandshakeexception-while-connecting-to-a-https-site – Arun Taneja Oct 12 '17 at 21:31
  • There can be many reasons.Check below link if tht helps https://stackoverflow.com/questions/30350120/sslhandshakeexception-while-connecting-to-a-https-site – Arun Taneja Oct 12 '17 at 21:33

2 Answers2

0

Which version are you using? We had the same issue before with an early version. After updating it to the latest the problem was solved.

Gergely A.
  • 404
  • 3
  • 6
0
  1. Un-synched same java version b/w the client and server.
  2. compatibility issues with different versions of SSL & TLS v1, where as client handles only using SSL v3).