diff --git a/lib/certificates/checkKeypair.js b/lib/certificates/checkKeypair.js index 3c2d514..c997d19 100644 --- a/lib/certificates/checkKeypair.js +++ b/lib/certificates/checkKeypair.js @@ -6,7 +6,7 @@ const fileNames = require("../fileNames"); module.exports.checkKeypair = (opts, options) => { console.log("certificates.checkKeypair for", opts.subject); - let id = opts.certificate.kid || opts.certificate.id || opts.subject; + let id = (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject; let pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem); // let jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk); diff --git a/lib/certificates/setKeypair.js b/lib/certificates/setKeypair.js index 8a2273c..97eb08b 100644 --- a/lib/certificates/setKeypair.js +++ b/lib/certificates/setKeypair.js @@ -4,7 +4,7 @@ const pathHelper = require("../pathHelper"); const fileNames = require("../fileNames"); module.exports.setKeypair = (opts, options) => { - let id = opts.certificate.kid || opts.certificate.id || opts.subject; + let id = (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject; console.log("certificates.setKeypair for", id); let pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);