v0.0.3: project scaffold

This commit is contained in:
AJ ONeal 2018-11-23 14:44:57 -07:00
parent 51777a63e0
commit b785b30623
12 changed files with 104 additions and 1 deletions

17
bin/rsa-csr.js Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var rsacsr = require('../index.js');
var keyname = process.argv[2];
var domains = process.argv[3].split(/,/);
var keypem = fs.readFileSync(keyname, 'ascii');
rsacsr({ key: keypem, domains: domains }).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);
});

View File

@ -0,0 +1,16 @@
-----BEGIN CERTIFICATE REQUEST-----
MIIClTCCAX0CAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3
DQEBAQUAA4IBDwAwggEKAoIBAQCba21UHE+VbDTpmYYFZUOV+OQ8AngOCdjROsPC
0KiEfMvEaEM3NQl58u6QL7G7QsErKViiNPm9OTFo6HF5JijfWzK7haHFuRMEsgI4
VwIYyhvqlJDfw/wt0AiVvSmoMfEQn1p1aiaO4V/RJSE3Vw/uz2bxiT22uSkSqOyS
hyfYE6dMHnuoBkzr4jvSifT+INmbv6Nyo4+AAMCZtYeHLrsFeSTjLL9jMPjI4ZkV
dlw2n3Xn9NbltF3/8Ao8dQfElqw+LIQWqU0oFHYNIP4ttfl5ObMKHaKSvBMyNruZ
R0El/ZsrcHLkAHRCLj07KRQJ81l5CUTPtQ02P1Eamz/nT4I3AgMBAAGgOjA4Bgkq
hkiG9w0BCQ4xKzApMCcGA1UdEQQgMB6CC2V4YW1wbGUuY29tgg93d3cuZXhhbXBs
ZS5jb20wDQYJKoZIhvcNAQELBQADggEBAGOFydCZPtRqnEidrB3vkpPp1GmQVqrl
XhqVM3X7UppsD3QDtJfgoSuBuVy3X/mPvy/Ly8WqEwJ7Ur+h76e7rgeFLvN5fQIr
frlpfCXrKaxxl6vxqKJ8s3Mn2LT8VmSVNig34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xN7iUVmAg+ToKjwbVnG5+7eXiC779rQVwnrD/0yh1AFJ8wjRPqDIR7ObXGHikIxT
1VSQWqiJm6AfZzDsL0LUD4YS3iPdhob7+NxLKWzqao/u4lhnDQaX9PKa12HFlny6
K1daL48CgYACUdZvHWCnpn2lvD/WGVLse5cCBahfsiNtNR6WV1/iCSuINYs6uPdA
Jlw7hm9m8TAmFWWyfL0s7wiRvAYkQvpxetorTwHJVLabBDJ+WBOAY2enOLHIRQv+
atAvHrLXjkUdzF96o0icyF6n7QzGfUPmeWGYg6BEClLS31Whe0eEVQ==
-----END RSA PRIVATE KEY-----

2
index.js Normal file
View File

@ -0,0 +1,2 @@
'use strict';
module.exports = require('./lib/rsa-csr.js');

0
lib/asn1.js Normal file
View File

0
lib/encoding.js Normal file
View File

0
lib/pem.js Normal file
View File

5
lib/rsa-csr.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
module.exports = function rsacsr(opts) {
throw new Error("not implemented yet");
};

0
lib/x509.js Normal file
View File

View File

@ -1,6 +1,6 @@
{
"name": "rsa-csr",
"version": "0.0.2",
"version": "0.0.3",
"description": "",
"main": "index.js",
"scripts": {

25
test.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
gencsr() {
keyfile=$1
domain=$2
csrfile=$3
openssl req -key $keyfile -new -nodes \
-config <(printf "[req]
prompt = no
req_extensions = req_ext
distinguished_name = dn
[ dn ]
CN = $domain
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = $domain
DNS.2 = www.$domain") \
-out $csrfile
}
gencsr fixtures/privkey-rsa-2048.pkcs1.pem example.com fixtures/example.com-www.csr.pem