From 7a97b360be687148efb9700954212041e27cc047 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 3 Jun 2019 03:27:38 -0600 Subject: [PATCH] v2.0.8: bugfix for node v6 --- lib/rsa-csr/README.md | 2 +- lib/rsa-csr/bin/rsa-csr.js | 6 +++- lib/rsa-csr/lib/csr.js | 4 +-- lib/rsa-csr/package.json | 66 +++++++++++--------------------------- package.json | 2 +- 5 files changed, 27 insertions(+), 53 deletions(-) diff --git a/lib/rsa-csr/README.md b/lib/rsa-csr/README.md index 108d55a..3e857db 100644 --- a/lib/rsa-csr/README.md +++ b/lib/rsa-csr/README.md @@ -171,7 +171,7 @@ Rather than trying to make a generic implementation that works with everything u this library is intentionally focused on around the use case of generating certificates for ACME services (such as Let's Encrypt). -That said, [please tell me](https://git.coolaj86.com/coolaj86/rsa-csr.js/issues) if it doesn't +That said, [please tell me](https://git.coolaj86.com/coolaj86/rsa-csr.js/issues/new) if it doesn't do what you need, it may make sense to add it (or otherwise, perhaps to help you create a fork). The primary goal of this project is for this code to do exactly (and all of) diff --git a/lib/rsa-csr/bin/rsa-csr.js b/lib/rsa-csr/bin/rsa-csr.js index a923330..48be3ea 100755 --- a/lib/rsa-csr/bin/rsa-csr.js +++ b/lib/rsa-csr/bin/rsa-csr.js @@ -15,9 +15,13 @@ try { // ignore } -rsacsr({ key: key, domains: domains }).then(function (csr) { +var csr = rsacsr.sync({ key: key, domains: domains }); +console.log(csr); +/* +.then(function (csr) { // Using error so that we can redirect stdout to file //console.error("CN=" + domains[0]); //console.error("subjectAltName=" + domains.join(',')); console.log(csr); }); +*/ diff --git a/lib/rsa-csr/lib/csr.js b/lib/rsa-csr/lib/csr.js index 219ab27..66f13f1 100644 --- a/lib/rsa-csr/lib/csr.js +++ b/lib/rsa-csr/lib/csr.js @@ -136,14 +136,14 @@ CSR.toDer = function encode(opts) { RSA.signSync = function signRsaSync(keypem, ab) { // 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); }; RSA.sign = function signRsa(keypem, ab) { return Promise.resolve().then(function () { diff --git a/lib/rsa-csr/package.json b/lib/rsa-csr/package.json index 72c4e67..7509f2d 100644 --- a/lib/rsa-csr/package.json +++ b/lib/rsa-csr/package.json @@ -1,64 +1,34 @@ { - "_from": "rsa-csr", - "_id": "rsa-csr@1.0.5", - "_inBundle": false, - "_integrity": "sha512-rmQY0RmcpLdsXEJgE1S2xBam09YVggDIqBGCJNFkhD6ONkmpSGjZ+28J6gWy+ygKHHgC7Z+OpzDLVQYowOte3A==", - "_location": "/rsa-csr", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "rsa-csr", - "name": "rsa-csr", - "escapedName": "rsa-csr", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/rsa-csr/-/rsa-csr-1.0.5.tgz", - "_shasum": "ac427ae3aa16089f5f26fc93047a7d2d844b0bf4", - "_spec": "rsa-csr", - "_where": "/Volumes/Data/git.coolaj86.com/coolaj86/rsa-compat.js", - "author": { - "name": "AJ ONeal", - "email": "coolaj86@gmail.com", - "url": "https://coolaj86.com/" - }, + "name": "rsa-csr", + "version": "1.0.7", + "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", + "main": "index.js", "bin": { "rsa-csr": "bin/rsa-csr.js" }, - "bundleDependencies": false, - "deprecated": false, - "description": "💯 A focused, zero-dependency library to generate a Certificate Signing Request (CSR) and sign it!", - "directories": { - "lib": "lib" - }, "files": [ "bin", "fixtures", "lib" ], - "homepage": "https://git.coolaj86.com/coolaj86/rsa-csr.js", + "directories": { + "lib": "lib" + }, + "scripts": { + "postinstall": "node lib/telemetry.js event:install", + "test": "bash test.sh" + }, + "repository": { + "type": "git", + "url": "https://git.coolaj86.com/coolaj86/rsa-csr.js" + }, "keywords": [ "zero-dependency", "CSR", "RSA", "x509" ], - "license": "MPL-2.0", - "main": "index.js", - "name": "rsa-csr", - "repository": { - "type": "git", - "url": "https://git.coolaj86.com/coolaj86/rsa-csr.js" - }, - "scripts": { - "postinstall": "node lib/telemetry.js event:install", - "test": "bash test.sh" - }, - "version": "1.0.5" + "author": "AJ ONeal (https://coolaj86.com/)", + "license": "MPL-2.0" } diff --git a/package.json b/package.json index 0292b81..8bb45c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rsa-compat", - "version": "2.0.7", + "version": "2.0.8", "engines": { "node": ">=10.12" },