Python Flash samples project
The Python Flask samples project shows how to use Rest PKI together with Web PKI on a Python project using the Flask framework. It is hosted on GitHub at:
https://github.com/LacunaSoftware/RestPkiSamples/tree/master/Python
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
sample/utils.py
- Install dependencies:
pip install -r requirements.txt
- Set the
FLASK_APP
environment variable to define the name of app that should be run:FLASK_APP=sample
- Run the web application:
flask run
- Access the URL http://localhost:5000
Project map
This section lists where to find the relevant parts in each feature sample on the project.
Authentication with digital certificate
- View: authentication.py
- Templates:
- index.html (JavaScript on signature-form.js)
- action.html
PAdES signature with file already on server
- View: pades_signature.py
- Templates:
- index.html (JavaScript on signature-form.js)
- action.html
PAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration puposes on the view upload.py and template index.html) is done the control flow is the same as in the sample PAdES signature with the 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 an 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.
PAdES signature without client communication
Not yet available on this project.
Open/validate an existing PAdES signature
Not yet available on this project.
Printer-friendly version
Not yet available on this project.
CAdES signature with file already on server
- View: cades_signature.py
- Templates:
- index.html (JavaScript on signature-form.js)
- action.html
CAdES signature with file uploaded by user
After the file upload (which is crudely implemented merely for demonstration puposes on the view upload.py and template index.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
Not yet available on this project.
XML signature of the entire document
- View: xml_signature.py
- Templates:
- full.html (JavaScript on signature-form.js)
- action.html
XML signature of an element
- View: xml_signature.py
- Templates:
- element.html (JavaScript on signature-form.js)
- action.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
- View: batch_pades_signature.py
- Template: index.html (JavaScript on batch-signature-form.js)
Optimized batch of PAdES signatures
Not yet available on this project.
Batch of CAdES signatures
- View: batch_cades_signature.py
- Template: index.html (JavaScript on batch-signature-form.js)
Batch of XML signatures of elements on the same document
Not yet available on this project.