'How to access a digital signed certificate for signing an upload in Java
I am targeting to solve a problem with respect to digitally signing an upload and based on the information I have thought of first trying out a POC.
What do I have? A class 3 digital signed certificate which I have purchased and is seen in my IE > Internet Options - >Content->Certificate section.
What I want to achieve? A means to access this certificate and have it handy in my backend implementation and use it to sign a document upload so that a string of characters (basically the signature) is to be seen as the last line of the document I upload once the signing is complete.
My attempt at the solution.
I have the below code to grab the certificate from the browser. But I have been struggling to understand if there are any hooks that can be used to populate the dropdown list with the list of certificates and if they can be accessed from the backend.
Any clues in this regard will be greatly helpful. This is my first question in the community. I have spent a lot of efforts to get to a solution, however I am a bit confused with Digital certificate, Digital Signed Certificate and their usage. A small hint/advise can help me tread the right path.
<body>
Welcome to DSC Test
<form action="add">
<td> Select the Digital Signature Certificate </td>
<select name = "dsc">
<option value = ""> Choose a DSC installed on your machine...</option>
<option value = "DC">Digicert</option>
<option value = "PS">PantaSign</option>
<option value = "TS">DSC</option>
</select>
<input type = "submit">
The backend
@Controller
public class HomeController {
@RequestMapping("/")
public String home() {
return "index.jsp";
}
@RequestMapping("add")
public ModelAndView add(@RequestParam("dsc") String dsc) {
System.out.println("DSC is " + dsc);
ModelAndView mv = new ModelAndView();
mv.setViewName("result.jsp");
return mv;
}
}
Thanks Tiffany
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
