This commit is contained in:
AJ ONeal 2016-08-08 19:43:31 -04:00
parent 8535b2127c
commit 06822604a1
2 changed files with 15 additions and 7 deletions

View File

@ -48,15 +48,15 @@ certInfo.testGetCertInfo = function () {
if (require.main === module) { if (require.main === module) {
var c = certInfo.testGetCertInfo(); var c = certInfo.testGetCertInfo();
console.log(''); console.info('');
console.log(c.notBefore.value); console.info(c.notBefore.value);
console.log(Date(c.notBefore.value).valueOf()); console.info(Date(c.notBefore.value).valueOf());
console.log(''); console.info('');
console.log(c.notAfter.value); console.info(c.notAfter.value);
console.log(Date(c.notAfter.value).valueOf()); console.info(Date(c.notAfter.value).valueOf());
console.log(''); console.info('');
} }

View File

@ -57,6 +57,10 @@ module.exports.create = function (le) {
var promise = le.store.accounts.checkKeypairAsync(args).then(function (keypair) { var promise = le.store.accounts.checkKeypairAsync(args).then(function (keypair) {
return RSA.import(keypair); return RSA.import(keypair);
}, function (/*err*/) { }, function (/*err*/) {
if (args.accountKeypair) {
return le.store.accounts.setKeypairAsync(args, RSA.import(args.accountKeypair));
}
return RSA.generateKeypairAsync(args.rsaKeySize, 65537, keypairOpts).then(function (keypair) { return RSA.generateKeypairAsync(args.rsaKeySize, 65537, keypairOpts).then(function (keypair) {
keypair.privateKeyPem = RSA.exportPrivatePem(keypair); keypair.privateKeyPem = RSA.exportPrivatePem(keypair);
keypair.publicKeyPem = RSA.exportPublicPem(keypair); keypair.publicKeyPem = RSA.exportPublicPem(keypair);
@ -174,6 +178,10 @@ module.exports.create = function (le) {
var promise = le.store.certificates.checkKeypairAsync(args).then(function (keypair) { var promise = le.store.certificates.checkKeypairAsync(args).then(function (keypair) {
return RSA.import(keypair); return RSA.import(keypair);
}, function (/*err*/) { }, function (/*err*/) {
if (args.domainKeypair) {
return le.store.certificates.setKeypairAsync(args, RSA.import(args.domainKeypair));
}
return RSA.generateKeypairAsync(args.rsaKeySize, 65537, keypairOpts).then(function (keypair) { return RSA.generateKeypairAsync(args.rsaKeySize, 65537, keypairOpts).then(function (keypair) {
keypair.privateKeyPem = RSA.exportPrivatePem(keypair); keypair.privateKeyPem = RSA.exportPrivatePem(keypair);
keypair.publicKeyPem = RSA.exportPublicPem(keypair); keypair.publicKeyPem = RSA.exportPublicPem(keypair);