Java 6 Spring MVC samples project
The Java 6 Spring MVC samples project shows how to use Rest PKI together with Web PKI on a Java 6 web application using the Spring MVC framework. It is hosted on GitHub at:
https://github.com/LacunaSoftware/RestPkiSamples/tree/master/Java/spring-mvc-java6
Note
This project is for Java 6 only. For Java 7+, see project Spring MVC.
Running the project
- Download the project or clone the repository
- Generate an API access token on the REST PKI website
- Paste your access token on the file Java/spring-mvc-java6/src/main/resources/application.properties
- In a command prompt, navigate to the folder
Java/sample-spring-java6
and run the commandgradlew run
(on Linux./gradlew run
). If you are using Windows, you can alternatively double-click the fileRun-Sample.bat
. - Once you see the message "Started Application in x.xxx seconds" (the on-screen percentage will not reach 100%), open a web browser and go the URL http://localhost:60458
Project map
This section lists where to find the relevant parts in each feature sample on the project.
Authentication with digital certificate
- Controller: AuthenticationController
- Views:
PAdES signature with file already on server
- Controller: PadesSignatureController
- Views:
- pades-signature.html (Javascript on signature-form.js)
- pades-signature-info.html
PAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration purposes on the controller
UploadController
and view
upload.html)
is done the control flow is the same as in the sample PAdES signature with file already on server, but with the URL parameter userfile
filled.
PAdES co-signature
After the control flow of the sample PAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the
same control flow is repeated, but now with the URL parameter userfile
filled.
PAdES marks
This feature is demonstrated as an optional configuration on the PAdES signature with file already on server sample which by default starts commented out. To enable it, uncomment the following line on PadesSignatureController:
signatureStarter.addPdfMark(PadesVisualElements.getPdfMark(1));
Tip
Try changing the argument to the getPdfMark(int)
method to see different PDF mark configurations
The relevant code is on the class PadesVisualElements, method getPdfMark(int)
.
PAdES signature using server key
Not yet available on this project.
PAdES signature without client communication
Not yet available on this project.
Open/validate an existing PAdES signature
- Controller: OpenPadesSignatureController
- View: open-pades-signature.html
Printer-friendly version
Not yet available on this project.
CAdES signature with file already on server
- Controller: CadesSignatureController
- Views:
- cades-signature.html (Javascript on signature-form.js)
- cades-signature-info.html
CAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration purposes on the controller
UploadController
and view
upload.html)
is done the control flow is the same as in the sample CAdES signature with file already on server, but with the URL parameter userfile
filled.
CAdES co-signature
After the control flow of the sample CAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the
same control flow is repeated, but now with the URL parameter cmsfile
filled.
CAdES signature using server key
Not yet available on this project.
Open/validate an existing CAdES signature
- Controller: OpenCadesSignatureController
- View: open-cades-signature.html
XML signature of the entire document
- Controller: XmlSignatureController
- Views:
- xml-full-signature.html (Javascript on signature-form.js)
- xml-signature-info.html
XML signature of an element
- Controller: XmlSignatureController
- Views:
- xml-element-signature.html (Javascript on signature-form.js)
- xml-signature-info.html
XAdES signature of an element
Not yet available on this project.
Open/validate signatures on an existing XML file
Not yet available on this project.
Batch of PAdES signatures
- Controller: BatchSignatureController
- View: batch-signature.html
- Javascript: batch-signature-form.js
Optimized batch of PAdES signatures
Not yet available on this project.
Batch of CAdES signatures
Not yet available on this project.
Batch of XML signatures of elements on the same document
Not yet available on this project.