This solution provides a REST microservice layer with express and JSingPDF library. JSignPDF is a Java project that sign and verify PDF files.
- Docker >= 17.12.0-ce
- docker-compose (OPTIONAL) >= 1.21.0
To run the service you will use a container solution through a Docker image.
In our tutorial we'll use docker-compose
to make it easier to configure the environment.
- First download the project to your local environment via the command:
git clone https://github.com/ekiametis/pdf-signer.git
- In the project root folder, execute one of the following commands:
docker run -e PRIVATE_KEY_FILE_PATH='./keys/private.pem' \
-e PUBLIC_KEY_FILE_PATH='./keys/public.pub' \
-p 4000:8080 \
--name pdf-signer-service pdf-signer-service
docker-compose up
PRIVATE_KEY_FILE_PATH
- REQUIRED
- Private key to decrypt the keystore password.
PUBLIC_KEY_FILE_PATH
- REQUIRED
- Public key to encrypt the keystore password.
PORT
- OPTIONAL | DEFAULT = 8080
- Node server port.
Reference | Resource | Http Method |
---|---|---|
1 - Retrieve the public key | /pdf/public-key |
GET |
2 - Sign PDF Document | /pdf/sign |
POST |
3 - Verify PDF Document | /pdf/verify |
POST |
This resource retrieve the public key to encrypt keystore password.
You don't need to pass any parameter.
Http Status | Content-Type | Response |
---|---|---|
200 | text/plain |
The public key text |
500 | text/plain |
Error message |
This resource sign a PDF Document.
Parameter | Type | Required | Response |
---|---|---|---|
body |
yes |
PDF stream | |
p12 | body |
yes |
P12 stream |
password | body |
yes |
Encrypted P12 password |
filename | body |
no |
PDF Filename for the response. If not passed the file will call signed_document |
Http Status | Content-Type | Response |
---|---|---|
200 | application/pdf |
Signed PDF |
500 | text/plain |
Error message |
This resource verify a Signed PDF Document.
Parameter | Type | Required | Response |
---|---|---|---|
body |
yes |
Signed PDF stream |
Http Status | Content-Type | Response |
---|---|---|
200 | text/plain |
String containing the verified resolution |
500 | text/plain |
Error message |