|
@ -340,16 +340,23 @@ Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.createSign = exports.Sign = Sign; |
|
|
exports.createSign = exports.Sign = Sign; |
|
|
function Sign(algorithm) { |
|
|
function Sign(algorithm, options) { |
|
|
if (!(this instanceof Sign)) |
|
|
if (!(this instanceof Sign)) |
|
|
return new Sign(algorithm); |
|
|
return new Sign(algorithm); |
|
|
this._binding = new binding.Sign(); |
|
|
this._binding = new binding.Sign(); |
|
|
this._binding.init(algorithm); |
|
|
this._binding.init(algorithm); |
|
|
|
|
|
|
|
|
|
|
|
stream.Writable.call(this, options); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
util.inherits(Sign, stream.Writable); |
|
|
|
|
|
|
|
|
Sign.prototype.update = Hash.prototype.update; |
|
|
Sign.prototype._write = function(chunk, callback) { |
|
|
|
|
|
this._binding.update(chunk); |
|
|
|
|
|
callback(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Sign.prototype.update = Hash.prototype.update; |
|
|
|
|
|
|
|
|
Sign.prototype.sign = function(key, encoding) { |
|
|
Sign.prototype.sign = function(key, encoding) { |
|
|
encoding = encoding || exports.DEFAULT_ENCODING; |
|
|
encoding = encoding || exports.DEFAULT_ENCODING; |
|
@ -364,17 +371,20 @@ Sign.prototype.sign = function(key, encoding) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.createVerify = exports.Verify = Verify; |
|
|
exports.createVerify = exports.Verify = Verify; |
|
|
function Verify(algorithm) { |
|
|
function Verify(algorithm, options) { |
|
|
if (!(this instanceof Verify)) |
|
|
if (!(this instanceof Verify)) |
|
|
return new Verify(algorithm); |
|
|
return new Verify(algorithm); |
|
|
|
|
|
|
|
|
this._binding = new binding.Verify; |
|
|
this._binding = new binding.Verify; |
|
|
this._binding.init(algorithm); |
|
|
this._binding.init(algorithm); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stream.Writable.call(this, options); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Verify.prototype.update = Hash.prototype.update; |
|
|
util.inherits(Verify, stream.Writable); |
|
|
|
|
|
|
|
|
|
|
|
Verify.prototype._write = Sign.prototype._write; |
|
|
|
|
|
Verify.prototype.update = Sign.prototype.update; |
|
|
|
|
|
|
|
|
Verify.prototype.verify = function(object, signature, sigEncoding) { |
|
|
Verify.prototype.verify = function(object, signature, sigEncoding) { |
|
|
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING; |
|
|
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING; |
|
|