This is a simple express service that demonstrate a simple digital signature using the crypto (node.js) module
- Create private/public key pair (e.g. using openssl)
openssl genrsa -out rsa_1024_private.pem 1024
openssl rsa -pubout -in rsa_1024_private.pem -out rsa_1024_public.pem
will result in two files rsa_1024_private.pem and rsa_1024_public.pem
- Create keys folder under the root folder with the following files:
keys
|
- rsa_1024_private.pem
|
- rsa_1024_public.pem
npm start
sign signing a message using the private key
curl -d '{"message": "the fox xof eht"}' -H "Content-Type: application/json" -X POST localhost:3001/sign
validate validating if the message has been signed using the appropriate public key returns boolean (true if the signature is valid)
curl -d '{"message": "the fox xof eht", "signature": "aaa"}' -H "Content-Type: application/json" -X POST localhost:3001/validate