mirror of
https://github.com/hanzoai/elliptic.git
synced 2026-09-23 23:51:03 +00:00
@@ -136,8 +136,8 @@ KeyPair.prototype.derive = function derive(pub) {
|
||||
};
|
||||
|
||||
// ECDSA
|
||||
KeyPair.prototype.sign = function sign(msg) {
|
||||
return this.ec.sign(msg, this);
|
||||
KeyPair.prototype.sign = function sign(msg, enc, options) {
|
||||
return this.ec.sign(msg, this, enc, options);
|
||||
};
|
||||
|
||||
KeyPair.prototype.verify = function verify(msg, signature) {
|
||||
|
||||
@@ -38,6 +38,10 @@ describe('ECDSA', function() {
|
||||
var signature = ecdsa.sign(msg, keys);
|
||||
assert(ecdsa.verify(msg, signature, keys), 'hex-private verify');
|
||||
|
||||
// key.sign(msg, options)
|
||||
var sign = keys.sign('hello', { canonical: true });
|
||||
assert.notEqual(sign.toDER('hex'), keys.sign('hello').toDER('hex'));
|
||||
|
||||
// Load public key from compact hex
|
||||
var keys = ecdsa.keyFromPublic(keys.getPublic(true, 'hex'), 'hex');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user