title: How to obtain public key from an SSL connection
body: <p>I have a REST service that I access via https. The parameters to the service include clear-text passwords which, at TRACE level logging appear in log files. To avoid inadvertent logging of these details I want to encrypt the passwords before sending, the obvious way (to me, at least) to do this being to use the public key of the https connection. </p>
  
  <p>I don't want to disable the logging because the detail is sometimes useful and it would be very simple to inadvertently re-enable it.</p>
  
  <p>I'm using Spring RestTemplate.</p>
  
  <p>How do I get hold of the public key?</p>