node v6 compat: don't pass new Uint8Array to rsa buffer
This commit is contained in:
parent
37ebdc0f62
commit
8fa9f411ae
@ -136,14 +136,14 @@ CSR.toDer = function encode(opts) {
|
|||||||
RSA.signSync = function signRsaSync(keypem, ab) {
|
RSA.signSync = function signRsaSync(keypem, ab) {
|
||||||
// Signer is a stream
|
// Signer is a stream
|
||||||
var sign = crypto.createSign('SHA256');
|
var sign = crypto.createSign('SHA256');
|
||||||
sign.write(new Uint8Array(ab));
|
sign.write(ab);
|
||||||
sign.end();
|
sign.end();
|
||||||
|
|
||||||
// The signature is ASN1 encoded, as it turns out
|
// The signature is ASN1 encoded, as it turns out
|
||||||
var sig = sign.sign(keypem);
|
var sig = sign.sign(keypem);
|
||||||
|
|
||||||
// Convert to a JavaScript ArrayBuffer just because
|
// 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);
|
||||||
};
|
};
|
||||||
RSA.sign = function signRsa(keypem, ab) {
|
RSA.sign = function signRsa(keypem, ab) {
|
||||||
return Promise.resolve().then(function () {
|
return Promise.resolve().then(function () {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rsa-csr",
|
"name": "rsa-csr",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"description": "💯 A focused, zero-dependency library to generate a Certificate Signing Request (CSR) and sign it!",
|
"description": "💯 A focused, zero-dependency library to generate a Certificate Signing Request (CSR) and sign it!",
|
||||||
"homepage": "https://git.coolaj86.com/coolaj86/rsa-csr.js",
|
"homepage": "https://git.coolaj86.com/coolaj86/rsa-csr.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user