In java SSL over https without certificate

前端 未结 5 1062
深忆病人
深忆病人 2021-01-14 09:27

Is it possible to use ssl with httpconnection without using certificate in java? i wan to use a random number or a semetric key.

Thank Raihan

5条回答
  •  醉梦人生
    2021-01-14 10:08

    Look at the accepted answer on the following question:

    How to ignore SSL certificate errors in Apache HttpClient 4.0

    You just need to create a TrustManager that basically doesn't check anything and just trusts everything. Although I can see why this is useful whilst developing, this does kind of negate the purpose of SSL. The TrustManager is there to avoid Man In The Middle attacks where a third party poses as the server to intercept and manipulate data etc, therefore if you don't verify the servers certificate, anybody could provide an 'invalid' certificate!

提交回复
热议问题