I want to receive a client certificate which was send in a post request with java spring. Do some one have an example to do this? Futher more i want to controll, if the header is set to "application/binary"! Some ideas?
Asked
Active
Viewed 1,627 times
1 Answers
2
If you are under a SSL context you can get the certchain from the request in this way:
(X509Certificate[]) req.getAttribute("javax.servlet.request.X509Certificate")
Ref: Reading Client Certificate in Servlet
If you are outside a SSL context and you want to send the X509 Object into the POST's body you have to serliaze it someway, for example in Base64 and read it like any other attribute.
To check the content-type just get it from the HttpServletRequest:
contetType = request.getContentType();
contentType.equals("application/binary");
To get the request using Spring MVC: Spring 3 MVC accessing HttpRequest from controller

Community
- 1
- 1

Marco A. Hernandez
- 791
- 4
- 15