This may be a recurring question, but I did not get full clarity from the previous question, so I am posting a new question. please take a look at this. I put the Ca certificate in my resources folder for ca certificate authentication, and the same ca certificate will also be there on the server.
- I am creating a .crt file that is not signed by any certificate and does not send it to the server.
- the server will sign the .crt file using the ca certificate and send the file again to me.
- after receiving the signed crt file, I need to check with my ca certificate, which I already have in the resources folder.
I can create a trustmanager with my ca certificate using the following code:
AssetManager assetManager = getResources().getAssets(); InputStream inputStream = null; try { inputStream = assetManager.open("Issuer certificate"); if (inputStream != null) } catch (IOException e) { e.printStackTrace(); } InputStream caInput = new BufferedInputStream(inputStream); Certificate ca; try { ca = cf.generateCertificate(caInput); System.out.println("ca=" + ((X509Certificate) ca).getSubjectDN()); } finally { caInput.close(); }
After receiving this trust manager, how do I compare the crt certificate that I received from the server ... My doubt is: do I need to create another trust manager even after these two trust managers compare the names of the providers? Please provide any information about this process if I am mistaken.
source share