Read error: Failure in SSL library, usually a prot

2019-04-30 01:40发布

问题:

I am trying to access an secure url by using a DefaultHttpClient. I am creating BKS file using portecel tool.

The jks file created using the same is working fine in java program but the bks is throwing the following exception:

java.io.IOException: Read error: Failure in SSL library, usually a protocol error

I am able to open the bks file in a keystore explorer and see the details.

The same is working fine in Android 2.3 but not in 2.2

let me know if anybody has faced such problem and solved it.

回答1:

I encountered the same problem in one of my applications. After googling a bit I found a bugreport from k9mail which refers to this bugreport on Android 2.2 and some more posts all indicating this is a framework bug in 2.2.

I found several sources like this one mentioning that importing the certificates server-side has to be done in some specific order, in order for Android to accept it. Since I have no control over the server I didn't pursue this option and I have no clue if it actually works; however, it might be interesting for you to investigate further.



回答2:

Check whether the server want client authentication.



回答3:

I had this problem with Retrofit Library. I solved this change, "https://10.0.3.2:4567" to "http://10.0.3.2:4567" in my URL connection.