Compare commits
	
		
			No commits in common. "master" and "v1.0.5" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							@ -1,9 +1,8 @@
 | 
				
			|||||||
[RSA-CSR.js](https://git.coolaj86.com/coolaj86/rsa-csr.js)
 | 
					[RSA-CSR.js](https://git.coolaj86.com/coolaj86/rsa-csr.js)
 | 
				
			||||||
==========
 | 
					==========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A [Root](https://therootcompany.com) Project.
 | 
					Sponsored by [Root](https://therootcompany.com),
 | 
				
			||||||
 | 
					built for [ACME.js](https://git.coolaj86.com/coolaj86/acme.js)
 | 
				
			||||||
Built for [ACME.js](https://git.coolaj86.com/coolaj86/acme.js)
 | 
					 | 
				
			||||||
and [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock-express.js)
 | 
					and [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock-express.js)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A focused, **zero-dependency** library that can do exactly one thing really, really well:
 | 
					A focused, **zero-dependency** library that can do exactly one thing really, really well:
 | 
				
			||||||
@ -11,6 +10,10 @@ A focused, **zero-dependency** library that can do exactly one thing really, rea
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
| < 300 lines of code | 1.7k gzipped | 4.7k minified | 8.5k with comments |
 | 
					| < 300 lines of code | 1.7k gzipped | 4.7k minified | 8.5k with comments |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Need JWK-to-PEM? Try [Rasha.js](https://git.coolaj86.com/coolaj86/rasha.js)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Need to generate an EC CSR? Try [ECSDA-CSR.js](https://git.coolaj86.com/coolaj86/ecdsa-csr.js)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Features
 | 
					Features
 | 
				
			||||||
========
 | 
					========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -29,10 +32,6 @@ Features
 | 
				
			|||||||
* [x] Vanilla Node.js
 | 
					* [x] Vanilla Node.js
 | 
				
			||||||
  * no school like the old school
 | 
					  * no school like the old school
 | 
				
			||||||
  * easy to read and understand
 | 
					  * easy to read and understand
 | 
				
			||||||
* [ ] JWK-to-PEM
 | 
					 | 
				
			||||||
    * See [Rasha.js](https://git.coolaj86.com/coolaj86/rasha.js)
 | 
					 | 
				
			||||||
* [ ] EC CSR
 | 
					 | 
				
			||||||
    * See [ECSDA-CSR.js](https://git.coolaj86.com/coolaj86/ecdsa-csr.js)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage
 | 
					Usage
 | 
				
			||||||
-----
 | 
					-----
 | 
				
			||||||
@ -57,7 +56,7 @@ var key = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
var domains = [ 'example.com', 'www.example.com' ];
 | 
					var domains = [ 'example.com', 'www.example.com' ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return rsacsr({ jwk: key, domains: domains }).then(function (csr) {
 | 
					return rsacsr({ key: key, domains: domains }).then(function (csr) {
 | 
				
			||||||
  console.log('CSR PEM:');
 | 
					  console.log('CSR PEM:');
 | 
				
			||||||
  console.log(csr);
 | 
					  console.log(csr);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@ -172,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
 | 
					this library is intentionally focused on around the use case of generating certificates for
 | 
				
			||||||
ACME services (such as Let's Encrypt).
 | 
					ACME services (such as Let's Encrypt).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
That said, [please tell me](https://git.coolaj86.com/coolaj86/rsa-csr.js/issues/new) if it doesn't
 | 
					That said, [please tell me](https://git.coolaj86.com/coolaj86/rsa-csr.js/issues) if it doesn't
 | 
				
			||||||
do what you need, it may make sense to add it (or otherwise, perhaps to help you create a fork).
 | 
					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)
 | 
					The primary goal of this project is for this code to do exactly (and all of)
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ try {
 | 
				
			|||||||
  // ignore
 | 
					  // ignore
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rsacsr({ jwk: key, domains: domains }).then(function (csr) {
 | 
					rsacsr({ key: key, domains: domains }).then(function (csr) {
 | 
				
			||||||
  // Using error so that we can redirect stdout to file
 | 
					  // Using error so that we can redirect stdout to file
 | 
				
			||||||
  //console.error("CN=" + domains[0]);
 | 
					  //console.error("CN=" + domains[0]);
 | 
				
			||||||
  //console.error("subjectAltName=" + domains.join(','));
 | 
					  //console.error("subjectAltName=" + domains.join(','));
 | 
				
			||||||
 | 
				
			|||||||
@ -110,13 +110,13 @@ RSA.sign = function signRsa(keypem, ab) {
 | 
				
			|||||||
  return Promise.resolve().then(function () {
 | 
					  return Promise.resolve().then(function () {
 | 
				
			||||||
    // Signer is a stream
 | 
					    // Signer is a stream
 | 
				
			||||||
    var sign = crypto.createSign('SHA256');
 | 
					    var sign = crypto.createSign('SHA256');
 | 
				
			||||||
    sign.write(ab);
 | 
					    sign.write(new Uint8Array(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 sig.buffer.slice(sig.byteOffset, sig.byteOffset + sig.byteLength);
 | 
					    return new Uint8Array(sig.buffer.slice(sig.byteOffset, sig.byteOffset + sig.byteLength));
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "rsa-csr",
 | 
					  "name": "rsa-csr",
 | 
				
			||||||
  "version": "1.0.6",
 | 
					  "version": "1.0.5",
 | 
				
			||||||
  "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