Posts

Showing posts with the label Digital Signature

Digital signature in Node.js

What is a digital signature? In short it is a piece of data sent by the sender to the receiver to establish the identity of the sender. Upon receiving the data, receiver can identify if the sender is the one it says it is. It is made possible by making use of Asymmetric Cryptography . Sender encrypts some data with the private key, to generate the signature. The signature and public key will be sent to the receiver. Receiver decrypts the signature using the public key and compares the decrypted value, to the expected data (data encrypted by the sender). Both the sender and receiver has to agree beforehand, on what will be the data they would be using. Wiki Link:  Digital Signature Node.js Implementation - Sender const crypto = require('crypto'); const privateKey = `-----BEGIN RSA PRIVATE KEY-----MIICXQIBAAKBgQDCtTEic76GBqUetJ1XXrrWZcxd8vJr2raWRqBjbGpSzLqa3YLvVxVeK49iSlI+5uLX/2WFJdhKAWoqO+03oH4TDSupolzZrwMFSylxGwR5jPmoNHDMS3nnzUkBtdr3NCfq1C34fQV0iUGdlPtJai