diff --git a/certoperations.js b/certoperations.js index 6c3c827f..53fe27df 100644 --- a/certoperations.js +++ b/certoperations.js @@ -33,7 +33,7 @@ module.exports.CertificateOperations = function () { // Create a self-signed certificate obj.GenerateRootCertificate = function (addThumbPrintToName, commonName, country, organization, strong) { - var keys = obj.pki.rsa.generateKeyPair((strong === true) ? 3072 : 2048); + var keys = obj.pki.rsa.generateKeyPair((strong == true) ? 3072 : 2048); var cert = obj.pki.createCertificate(); cert.publicKey = keys.publicKey; cert.serialNumber = String(Math.floor((Math.random() * 100000) + 1)); @@ -42,8 +42,8 @@ module.exports.CertificateOperations = function () { cert.validity.notAfter = new Date(); cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30); if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); } - if (country === undefined) { country = "unknown"; } - if (organization === undefined) { organization = "unknown"; } + if (country == null) { country = "unknown"; } + if (organization == null) { organization = "unknown"; } var attrs = [{ name: "commonName", value: commonName }, { name: "organizationName", value: organization }, { name: "countryName", value: country }]; cert.setSubject(attrs); cert.setIssuer(attrs); @@ -56,7 +56,7 @@ module.exports.CertificateOperations = function () { // Issue a certificate from a root obj.IssueWebServerCertificate = function (rootcert, addThumbPrintToName, commonName, country, organization, extKeyUsage, strong) { - var keys = obj.pki.rsa.generateKeyPair((strong === true) ? 3072 : 2048); + var keys = obj.pki.rsa.generateKeyPair((strong == true) ? 3072 : 2048); var cert = obj.pki.createCertificate(); cert.publicKey = keys.publicKey; cert.serialNumber = String(Math.floor((Math.random() * 100000) + 1)); @@ -66,8 +66,8 @@ module.exports.CertificateOperations = function () { cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30); if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); } var attrs = [{ name: "commonName", value: commonName }]; - if (country != undefined) { attrs.push({ name: "countryName", value: country }); } - if (organization != undefined) { attrs.push({ name: "organizationName", value: organization }); } + if (country != null) { attrs.push({ name: "countryName", value: country }); } + if (organization != null) { attrs.push({ name: "organizationName", value: organization }); } cert.setSubject(attrs); cert.setIssuer(rootcert.cert.subject.attributes); @@ -268,7 +268,7 @@ module.exports.CertificateOperations = function () { } var rootCertAndKey, rootCertificate, rootPrivateKey, rootName; - if (r.root === undefined) { + if (r.root == null) { // If the root certificate does not exist, create one console.log("Generating root certificate..."); rootCertAndKey = obj.GenerateRootCertificate(true, "MeshCentralRoot", null, null, strongCertificate); diff --git a/package.json b/package.json index ac820c8e..fa2aebb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.1.9-z", + "version": "0.2.0-a", "keywords": [ "Remote Management", "Intel AMT",