Ruby on Rails samples project
The Ruby on Rails samples project shows how to use Rest PKI together with Web PKI on a Ruby project using the Ruby on Rails framework. It is hosted on GitHub at:
https://github.com/LacunaSoftware/PkiSuiteSamples/tree/master/ruby/rails
Running the project
- Download the project or clone the repository
- Install dependencies:
bundle install - Run application:
rails server - Access the URL http://localhost:3000
Project map
This section lists where to find the relevant parts in each feature sample on the project.
Authentication with digital certificate
- Controller: AuthenticationRestController
- Views:
- index.html.erb (JavaScript on signature-form.js)
- action.html.erb
PAdES signature with file already on server
- Controller: PadesSignatureRestController
- Views:
- index.html.erb (JavaScript on signature-form.js)
- action.html.erb
PAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration purposes on the controller
ServerFilesController
and view
index.html.erb)
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
Not yet available on this project.
PAdES signature using server key
Not yet available on this project.
Open/validate an existing PAdES signature
- Controller: OpenPadesRestController
- View: index.html.erb
Printer-friendly version
After the control flow of the sample PAdES signature with file already on server is completed and the link Download a printer-friendly version of the signed file is clicked, the flow goes to the controller PrinterVersionPadesRestController with the signed file's id in the URL.
CAdES signature with file already on server
- Controller: CadesSignatureRestController
- Views:
- index.html.erb (JavaScript on signature-form.js)
- action.html.erb
CAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration purposes on the controller
ServerFilesController
and view
index.html.erb
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 userfile filled.
Open/validate an existing CAdES signature
Not yet available on this project.
XML signature of the entire document
- Controller: XmlSignatureRestController
- index.html.erb (JavaScript on signature-form.js)
- action.html.erb
XML signature of an element
- Controller: XmlNfeSignatureRestController
- Views:
- index.html.erb (JavaScript on signature-form.js)
- action.html.erb
XAdES signature of an element
Demonstrated by the digital diploma sample, which signs the DadosDiploma and DadosRegistro elements with the ICP-Brasil XAdES AD-RT policy and then the whole document with the AD-RA policy:
- Controller: XmlDiplomaSignatureRestController
- Views:
Open/validate signatures on an existing XML file
Not yet available on this project.
Batch of PAdES signatures
- Controller: BatchPadesRestController
- View: index.html.erb (JavaScript on batch-signature-restpki-form.js)
Batch of CAdES signatures
- Controller: BatchCadesRestController
- View: index.html.erb (JavaScript on batch-signature-restpki-form.js)