This is an implementation of virtual signature with RSA keys.
Virtual signature is a method for verifying and validating the identity of the author of pieces of data on a system.
That is possible using a pair of RSA keys, one public and one private. Basically, the person 1, Bob, wants to send a message to a second person, Alice, in a secure way, a password for example.
Bob then signs the message with his private RSA Key, generating a signature on the message.
When Alice receives the message, to verify if it really is from Bob, she uses the public RSA key (pair of Bob's) on the signed data. If the data was modificated or not signed with Bob's key it will be detected.
To run this application Node must be installed. Just enter on the project folder via terminal and type the following comand:
yarn
npm install
And then:
npm run dev
or
yarn dev
After that the application will be running on http://localhost:3333/
You can also run the following commands to transpile the code to JavaScript version, that will be generated at the /dist
folder in the project root, but the static files in src/public
will not be moved, copy and paste it manually.
npm run build
or
yarn build
METHOD: POST
BODY: NONE
RESPONSE: JSON
{
"privateKey": "-----BEGIN RSA PRIVATE KEY-----\n ... \n-----END RSA PUBLIC KEY-----",
"publicKey": "-----BEGIN RSA PUBLIC KEY-----\n ... \n-----END RSA PUBLIC KEY-----"
}
METHOD: POST
BODY: JSON
Example:
{
"privateKey": "-----BEGIN RSA PUBLIC KEY-----\n ... \n-----END RSA PUBLIC KEY-----",
"data": "cypher text in base64"
}
RESPONSE: JSON
{
"signature": "signature hash"
}
METHOD: POST
BODY: JSON
Example:
{
"publicKey": "-----BEGIN RSA PUBLIC KEY-----\n ... \n-----END RSA PUBLIC KEY-----",
"signature": "signature hash",
"data": "message to verify"
}
RESPONSE: HTTP CODE
The API return only a simple HTTP Code as response.
200
if is OK400
if is not.
This is just a simple example for learning purpose and a college work for System Security subject. Feel free to use.