Node.js crypto create Sign/Verify RSA-SHA256
var crypto = require("crypto"), fs = require("fs"); var signer, sign, verifier, privateKey, publicKey, result; privateKey = fs.readFileSync("mykey.pem", "utf8"); publicKey = fs.readFileSync("mypub.pem", "utf8"); signer = crypto.createSign("RSA-SHA256"); signer.update("hello world!"); signer.update("hello node!"); sign = signer.sign(privateKey, "hex"); console.log(sign);//from w ww . j a va 2 s. c om verifier = crypto.createVerify("RSA-SHA256"); verifier.update("hello world!"); verifier.update("hello node!"); result = verifier.verify(publicKey, sign, "hex"); console.log(result);//true