Skip to content

Instantly share code, notes, and snippets.

@unfernandito
Created October 28, 2016 20:46
Show Gist options
  • Save unfernandito/892faadc35a43d2d2c43a7aeee65d6db to your computer and use it in GitHub Desktop.
Save unfernandito/892faadc35a43d2d2c43a7aeee65d6db to your computer and use it in GitHub Desktop.
Code For Auth ECDSA
// Try API v2 Signature
if (version === 2) {
var hexkey = new Buffer(key, 'base64').toString('hex');
var hexsig = new Buffer(signature, 'base64').toString('hex');
var checkSign = new jscrypto.Signature({
'alg': 'SHA256withECDSA',
'prov': 'cryptojs/jsrsa'
});
checkSign.initVerifyByPublicKey({
'ecpubhex': hexkey,
'eccurvename': 'secp256k1'
});
checkSign.updateString(message);
return checkSign.verify(hexsig);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment