crypto: Pass options to ctor calls
This commit is contained in:
parent
1d17ced200
commit
7af075ee30
@ -59,7 +59,7 @@ var StringDecoder = require('string_decoder').StringDecoder;
|
|||||||
|
|
||||||
function Credentials(secureProtocol, flags, context) {
|
function Credentials(secureProtocol, flags, context) {
|
||||||
if (!(this instanceof Credentials)) {
|
if (!(this instanceof Credentials)) {
|
||||||
return new Credentials(secureProtocol);
|
return new Credentials(secureProtocol, flags, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!crypto) {
|
if (!crypto) {
|
||||||
@ -171,7 +171,7 @@ util.inherits(LazyTransform, stream.Transform);
|
|||||||
exports.createHash = exports.Hash = Hash;
|
exports.createHash = exports.Hash = Hash;
|
||||||
function Hash(algorithm, options) {
|
function Hash(algorithm, options) {
|
||||||
if (!(this instanceof Hash))
|
if (!(this instanceof Hash))
|
||||||
return new Hash(algorithm);
|
return new Hash(algorithm, options);
|
||||||
this._binding = new binding.Hash(algorithm);
|
this._binding = new binding.Hash(algorithm);
|
||||||
LazyTransform.call(this, options);
|
LazyTransform.call(this, options);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ exports.createHmac = exports.Hmac = Hmac;
|
|||||||
|
|
||||||
function Hmac(hmac, key, options) {
|
function Hmac(hmac, key, options) {
|
||||||
if (!(this instanceof Hmac))
|
if (!(this instanceof Hmac))
|
||||||
return new Hmac(hmac, key);
|
return new Hmac(hmac, key, options);
|
||||||
this._binding = new binding.Hmac();
|
this._binding = new binding.Hmac();
|
||||||
this._binding.init(hmac, toBuf(key));
|
this._binding.init(hmac, toBuf(key));
|
||||||
LazyTransform.call(this, options);
|
LazyTransform.call(this, options);
|
||||||
@ -233,7 +233,7 @@ function getDecoder(decoder, encoding) {
|
|||||||
exports.createCipher = exports.Cipher = Cipher;
|
exports.createCipher = exports.Cipher = Cipher;
|
||||||
function Cipher(cipher, password, options) {
|
function Cipher(cipher, password, options) {
|
||||||
if (!(this instanceof Cipher))
|
if (!(this instanceof Cipher))
|
||||||
return new Cipher(cipher, password);
|
return new Cipher(cipher, password, options);
|
||||||
this._binding = new binding.Cipher;
|
this._binding = new binding.Cipher;
|
||||||
|
|
||||||
this._binding.init(cipher, toBuf(password));
|
this._binding.init(cipher, toBuf(password));
|
||||||
@ -293,7 +293,7 @@ Cipher.prototype.setAutoPadding = function(ap) {
|
|||||||
exports.createCipheriv = exports.Cipheriv = Cipheriv;
|
exports.createCipheriv = exports.Cipheriv = Cipheriv;
|
||||||
function Cipheriv(cipher, key, iv, options) {
|
function Cipheriv(cipher, key, iv, options) {
|
||||||
if (!(this instanceof Cipheriv))
|
if (!(this instanceof Cipheriv))
|
||||||
return new Cipheriv(cipher, key, iv);
|
return new Cipheriv(cipher, key, iv, options);
|
||||||
this._binding = new binding.Cipher();
|
this._binding = new binding.Cipher();
|
||||||
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
|
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
|
||||||
this._decoder = null;
|
this._decoder = null;
|
||||||
@ -314,7 +314,7 @@ Cipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
|
|||||||
exports.createDecipher = exports.Decipher = Decipher;
|
exports.createDecipher = exports.Decipher = Decipher;
|
||||||
function Decipher(cipher, password, options) {
|
function Decipher(cipher, password, options) {
|
||||||
if (!(this instanceof Decipher))
|
if (!(this instanceof Decipher))
|
||||||
return new Decipher(cipher, password);
|
return new Decipher(cipher, password, options);
|
||||||
|
|
||||||
this._binding = new binding.Decipher;
|
this._binding = new binding.Decipher;
|
||||||
this._binding.init(cipher, toBuf(password));
|
this._binding.init(cipher, toBuf(password));
|
||||||
@ -337,7 +337,7 @@ Decipher.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
|
|||||||
exports.createDecipheriv = exports.Decipheriv = Decipheriv;
|
exports.createDecipheriv = exports.Decipheriv = Decipheriv;
|
||||||
function Decipheriv(cipher, key, iv, options) {
|
function Decipheriv(cipher, key, iv, options) {
|
||||||
if (!(this instanceof Decipheriv))
|
if (!(this instanceof Decipheriv))
|
||||||
return new Decipheriv(cipher, key, iv);
|
return new Decipheriv(cipher, key, iv, options);
|
||||||
|
|
||||||
this._binding = new binding.Decipher;
|
this._binding = new binding.Decipher;
|
||||||
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
|
this._binding.initiv(cipher, toBuf(key), toBuf(iv));
|
||||||
@ -360,7 +360,7 @@ Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
|
|||||||
exports.createSign = exports.Sign = Sign;
|
exports.createSign = exports.Sign = Sign;
|
||||||
function Sign(algorithm, options) {
|
function Sign(algorithm, options) {
|
||||||
if (!(this instanceof Sign))
|
if (!(this instanceof Sign))
|
||||||
return new Sign(algorithm);
|
return new Sign(algorithm, options);
|
||||||
this._binding = new binding.Sign();
|
this._binding = new binding.Sign();
|
||||||
this._binding.init(algorithm);
|
this._binding.init(algorithm);
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ Sign.prototype.sign = function(key, encoding) {
|
|||||||
exports.createVerify = exports.Verify = Verify;
|
exports.createVerify = exports.Verify = Verify;
|
||||||
function Verify(algorithm, options) {
|
function Verify(algorithm, options) {
|
||||||
if (!(this instanceof Verify))
|
if (!(this instanceof Verify))
|
||||||
return new Verify(algorithm);
|
return new Verify(algorithm, options);
|
||||||
|
|
||||||
this._binding = new binding.Verify;
|
this._binding = new binding.Verify;
|
||||||
this._binding.init(algorithm);
|
this._binding.init(algorithm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user