Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const crypto = require('crypto');
- const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
- namedCurve: 'sect239k1'
- });
- const sign = crypto.createSign('SHA256');
- sign.write('some data to sign');
- sign.end();
- const signature = sign.sign(privateKey);
- const verify = crypto.createVerify('SHA256');
- verify.write('some data to sign');
- verify.end();
- console.log(verify.verify(publicKey, signature));
- //console.log(publicKey.export({type:'spki', format: 'pem'}))
- //console.log(privateKey.export({type:'sec1', format: 'pem'}))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement