node v6 bugfix: don't convert NodeBuffer to Uint8Array

This commit is contained in:
AJ ONeal 2019-06-03 03:25:19 -06:00
parent 361b0bf994
commit 8211d9b6d8
1 changed files with 2 additions and 2 deletions

View File

@ -110,13 +110,13 @@ RSA.sign = function signRsa(keypem, ab) {
return Promise.resolve().then(function () {
// Signer is a stream
var sign = crypto.createSign('SHA256');
sign.write(new Uint8Array(ab));
sign.write(ab);
sign.end();
// The signature is ASN1 encoded, as it turns out
var sig = sign.sign(keypem);
// Convert to a JavaScript ArrayBuffer just because
return new Uint8Array(sig.buffer.slice(sig.byteOffset, sig.byteOffset + sig.byteLength));
return sig.buffer.slice(sig.byteOffset, sig.byteOffset + sig.byteLength);
});
};