Trusting all certificates using HttpClient over HTTPS

后端 未结 21 2296
北恋
北恋 2020-11-21 04:50

Recently posted a question regarding the HttpClient over Https (found here). I\'ve made some headway, but I\'ve run into new issues. As with my last problem, I

21条回答
  •  鱼传尺愫
    2020-11-21 05:11

    Any body still struggling with StartCom SSL Certificates on Android 2.1 visit https://www.startssl.com/certs/ and download the ca.pem, now in the answer provided by @emmby replace

    `export CLASSPATH=bcprov-jdk16-145.jar
     CERTSTORE=res/raw/mystore.bks
          if [ -a $CERTSTORE ]; then
              rm $CERTSTORE || exit 1
          fi
     keytool \
      -import \
      -v \
      -trustcacerts \
      -alias 0 \
      -file <(openssl x509 -in mycert.pem) \
      -keystore $CERTSTORE \
      -storetype BKS \
      -provider org.bouncycastle.jce.provider.BouncyCastleProvider \
      -providerpath /usr/share/java/bcprov.jar \
      -storepass some-password`
    

    with

     `export CLASSPATH=bcprov-jdk16-145.jar
     CERTSTORE=res/raw/mystore.bks
          if [ -a $CERTSTORE ]; then
              rm $CERTSTORE || exit 1
          fi
     keytool \
      -import \
      -v \
      -trustcacerts \
      -alias 0 \
      -file <(openssl x509 -in ca.pem) \
      -keystore $CERTSTORE \
      -storetype BKS \
      -provider org.bouncycastle.jce.provider.BouncyCastleProvider \
      -providerpath /usr/share/java/bcprov.jar \
      -storepass some-password`
    

    Should work out of the box. I was struggling it for over a day even after a perfect answer by @emmby.. Hope this helps someone...

提交回复
热议问题