Calculating and verifying digital signatures with Node.js
In this section, we'll learn how to use Node.js to compute and verify digital signatures using RSA and ECC. Luckily for us, the Node.js built-in crypto
module contains all the functions we need to do that.
Using RSA
To start, we're going to look at using RSA to calculate and verify digital signatures with Node.js by using crypto.sign
and crypto.verify
:
6.1: rsaSign and rsaVerify (part of signatures-rsa.js)
const crypto = require('crypto') function rsaSign(privateKey, message) { return crypto.sign( 'sha256', message, { key: privateKey, padding: crypto.constants.RSA_PKCS1_PSS_PADDING...