Created
October 28, 2016 20:46
-
-
Save unfernandito/892faadc35a43d2d2c43a7aeee65d6db to your computer and use it in GitHub Desktop.
Code For Auth ECDSA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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