I've a secure Tomcat web server and I would like to retrieve the context certificates when my application connects to the server.
In my servlet I've the following capture:
for(Enumeration enum = request.getAttributeName(); enum.hasMoreElements() ;)
System.out.println("Attribute: " + enum.nextElement());In my console I obtain:
Attribute: javax.servlet.request.cipher_suite Attribute: javax.servlet.request.key_size
but I haven't the certificates that it establishes the secure context.
How can I retrieve these certificates??
Regards and thanks in advance.
----------
My application where I open HttpsURLConnection (class of IAIK):
System.getProperties().put("java.protocol.handler.pkgs","iaik.protocol");
SSLClientContext context = new SSLClientContext(); context.setEnabledCipherSuites(<ciphers>);
X509Certificate server = <server certificate>; X509Certificate ra = <RA certificate>; X509Certificate[] chain = X509Certificate[1]; chain[0] = ra;
context.addClientCredentials(chain,<RA private key>); context.addTrustedCertificate(server);
HttpsURLConnection https = new HttpsURLConnection(new URL(<servlet URL>)); https.setSSLContext(context); https.setRequestMethod(POST);
