var cryptor = require('crypto');
var sign = cryptor.createSign('RSA-SHA256');
sign.update('some data to sign');
var privateKey = fs.readFileSync(path.resolve('./signkey/secret.key'), "utf8");
var signedData = sign.sign(privateKey, 'base64');
var verify = cryptor.createVerify('RSA-SHA256');
verify.write('some data to sign');
verify.end();
var publicKey = fs.readFileSync(path.resolve('./signkey/public.key'), "utf8");
console.log(verify.verify(publicKey, signedData, 'base64'));
sign時とverify時でフォーマットをbase64ならbase64で合わせないと検証に失敗します。