In Java How do you extract “issued to” or user from a SSL cert within an HttpRequest?
what I’m working with:
Object certChain = request
.getAttribute("javax.servlet.request.X509Certificate");
if (certChain != null)
{
X509Certificate certs[] = (X509Certificate[]) certChain;
X509Certificate cert = certs[0];
String user = cert.getSubjectDN().getName();
}
Here’s the code to extract the “Issued To” aka Subject for a cert within an httprequest,
JDK 6 has the API getSubjectX500Prinicpal() in it’s rt.jar locally, not sure about the previous versions,
