相互认证Android和Tomcat

我想为我的应用和服务器进行相互认证。 我按照这一步:

1)创建证书。 和服务器tomcat的密钥库(tomcat.keystore)

2)创建证书。 为客户

3)导入客户端证书。 进入服务器密钥库

4)为Android创建一个bks密钥库(smartssl.bks)

5)导入证书。 服务器和客户端进入密钥库Android

现在我配置Tomcat:

 

在Android应用程序中,我使用Volley框架:

  InputStream keyStore = getResources().openRawResource(R.raw.smartssl); // Usually getting the request queue shall be in singleton like in {@see Act_SimpleRequest} // Current approach is used just for brevity RequestQueue queue = Volley .newRequestQueue(Act_SsSslHttpClient.this, new ExtHttpClientStack(new SslHttpClient(keyStore, "pass", 443))); StringRequest myReq = new StringRequest(Method.GET, "https://192.168.1.4:8443/REST/app/generali/getA", createMyReqSuccessListener(), createMyReqErrorListener()){ @Override public Map getHeaders() throws AuthFailureError { return createBasicAuthHeader("user", "strongpassword"); }}; queue.add(myReq); } }); 

有了这个配置。 我有这个错误:

 no peer certificate 

如果我尝试使用以下方法更改Tomcat配置:

 clientAuth="false" 

有效,所以问题出在bks文件中? 或者在哪里?

我在应用程序中解决了Keystore和BKS中的Truststore。

这里有一个创建自我证书的指南:

为客户端和服务器创建自我证书

这里有与Volley相互认可的类示例:

Mutual auth TLS / SSL的示例类

SSLSocket类