java - Getting SSL context for HttpsURLConnection from X509Certificate -


I'm quite new to certificates, but I have to do something (in Java):

1 ) I have the requester's certificate in my hand:

  X509 certificate [] certs = (X509 certificate []) request.getAttribute ("javax.servlet.request.X509 certificate"); 2) I have to request another URL with that certificate (is this possible?), Something like this:  
  url = URL = new URL (Server ); HttpURL Connection Connection = (HttpURL Connection) url.openConnection (); If (Example of connection HttpsURLConnection) {((HttpsURLConnection Connection)) .setSSLSocketFactory (???); }  

My question is, how do I add a certificate from 1 to 1 with the request? 2)?

Cheers.

You will not be able to do this. You need both the public and private components of the certificate to establish an authenticated SSL connection. This will be a security hole that you are suggesting, to do so to show a server in the form of an entity that it is not.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -