Compare commits

...
22 Commits
Author SHA1 Message Date
mcbueller 531be027f5 package-lock update 2025-02-03 15:01:48 +00:00
mcbueller 3deb4ccf9f CA missing required keyUsage and extKeyUsage 2025-01-29 19:08:45 +00:00
Lyndsey Strauss b44c79c3af updating package.json version number 2022-07-05 15:19:27 +00:00
buhler 39dbf747e6 Merge pull request #22 from NationalSecurityAgency/add-new-rdn-types
add new attribute types to certificates
2022-07-05 11:03:29 -04:00
Lyndsey Strauss 663bb10e0b added note on only server cert options in table 2022-07-05 15:01:10 +00:00
Lyndsey Strauss 0c30721bca added table for attribute types 2022-07-05 14:16:56 +00:00
Lyndsey Strauss 5c976801fb add new attribute types to certificates 2022-06-29 21:01:26 +00:00
straussly e7f88431c6 Merge pull request #21 from typoBot3000/main
fix some typos
2022-05-13 14:37:23 -04:00
typoBot3000 f8e3721210 fix some typos
fixed some typos
2022-05-09 18:47:53 -04:00
Lyndsey Strauss e8deada753 updating madcert to 2.3.1 and node-forge version number in package.json 2022-03-30 16:03:00 +00:00
straussly a21293fe94 Merge pull request #20 from NationalSecurityAgency/dependabot/npm_and_yarn/node-forge-1.3.0
Bump node-forge from 1.2.1 to 1.3.0
2022-03-30 10:55:52 -04:00
dependabot[bot] b9067f2342 Bump node-forge from 1.2.1 to 1.3.0
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2022-03-25 23:54:01 +00:00
straussly aa4746a13e updating version number 2022-02-10 18:03:31 -05:00
straussly d978f6acb9 Merge pull request #19 from NationalSecurityAgency/remove-key-usages
remove nonRepudiation and dataEncipherment key usages
2022-02-10 11:07:54 -05:00
rtbuhle 3bc0fefe5f remove nonRepudiation and datEncipherment key usages 2022-02-10 11:14:03 +00:00
buhler 0828d1b4cf Merge pull request #18 from NationalSecurityAgency/upgrade-mocha-fsextra-yargs
upgrade mocha, fsextra, yargs, and madcert version number
2022-01-28 07:44:23 -05:00
Lyndsey Strauss f14953fc14 upgrade date fns, chai,and node forge 2022-01-27 22:49:10 +00:00
Lyndsey Strauss 52dae35d1d upgrade mocha, fsextra, yargs, and madcert version number 2022-01-27 15:05:20 +00:00
buhler ae650a88a6 Merge pull request #17 from NationalSecurityAgency/server-cert-cn-fix
added fix to automatically fill in cn from server name
2022-01-20 07:20:56 -05:00
straussly 594173b92e Merge pull request #16 from NationalSecurityAgency/dependabot/npm_and_yarn/node-forge-1.0.0
Bump node-forge from 0.10.0 to 1.0.0
2022-01-19 08:43:37 -05:00
Lyndsey Strauss d0d6b2ff0b added fix to automatically fill in cn from server name 2022-01-19 13:42:49 +00:00
dependabot[bot] 8e8b3807da Bump node-forge from 0.10.0 to 1.0.0
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 0.10.0 to 1.0.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/0.10.0...v1.0.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2022-01-15 07:53:29 +00:00
10 changed files with 398 additions and 459 deletions

No files matched your search

+2 -1
View File
@@ -1 +1,2 @@
node_modules/
node_modules/
.idea/
+23 -6
View File
@@ -6,7 +6,7 @@ MADCert is a cross-platform tool that consists of a certificate generator, a fil
MADCert does not require openssl or any other programs to be installed in the Operating System.
Both Node.js and CLI exmples are provided below.
Both Node.js and CLI examples are provided below.
## Usage
@@ -49,7 +49,7 @@ To add MADCert to your project:
madcert.listCACerts();
- List Server Cerficates
- List Server Certificates
madcert.listServerCerts();
@@ -146,7 +146,7 @@ By default, the certs created by MADCert will be placed under a "pki" folder in
npx madcert ca-list
- List Server Cerficates
- List Server Certificates
npx madcert server-list
@@ -190,6 +190,23 @@ By default, the certs created by MADCert will be placed under a "pki" folder in
#### Arguments
- `name` Name is used for the name of the directory under which PKI files are created. If the `--common-name` option is not used then `name` will also be used for the Common Name in the certificate subject.
- `ca_name` CA name is used to identify the Certificate Authority to use when creating or removing users and servers.
- `root_ca_name` When creating an intermediate Certificate Authority, `root_ca_name` identifies the root CA that issues the intermediate CA's certificate.
| | Alias | Type | Default Value | Description |
| :--- | :----:| :----: | :----: | ---: |
| `name` | | String | | Name is used for the name of the directory under which PKI files are created. If the `--common-name` option is not used then `name` will also be used for the Common Name in the certificate subject. |
| `ca-name` | | String | | CA name is used to identify the Certificate Authority to use when creating or removing users and servers. |
| `root_ca-name` | `-r` | String | | When creating an intermediate Certificate Authority, `root_ca_name` identifies the root CA that issues the intermediate CA's certificate.
| `path` | `-p` | String | '/pki' | Base path for pki |
| `common-name` | `-n` | String | | Common Name in the Distinguished Name |
| `country` | `-c` | String | | Country |
| `locality` | | String | | Locality|
| `state` | `-st` | String | | State|
| `expired` | `-e` | Boolean | | Create an expired certificate |
| `org` | `-o` | Array | | Organization name. This option can be specified multiple times|
| `org-unit` | `-u` | Array | | Organizational unit name. This option can be specified multiple times.|
| `password` | `-w` | String | 'changeme' | Certificate password |
| `subject-alt-dns` | `-d` | Array | | Create certificate with DNS subject alternative name. This option can be specified multiple times and only applies to server certs.|
| `subject-alt-ip` | `-i` | Array | | Create certificate with IP subject alternative name. This option can be specified multiple times and only applies to server certs. |
| `subject-alt-email`| `-m` | Array | | Create certificate with rfc822/email subject alternative name. This option can be specified multiple times and only applies to server certs. |
| `valid-from` | `-f` | Date | | Valid from date in ISO 8601 format |
| `valid-to` | `-t` | Date | | Valid to date in ISO 8601 format|
+290 -442
View File
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "madcert",
"version": "2.2.0",
"version": "2.5.0",
"description": "Make a Development Cert",
"engines": {
"node": ">=10.16.0"
@@ -53,13 +53,13 @@
},
"dependencies": {
"date-fns": "^2.19.0",
"fs-extra": "^9.1.0",
"fs-extra": "10.0.0",
"lodash": "^4.17.21",
"node-forge": "^0.10.0",
"yargs": "^16.2.0"
"node-forge": "^1.3.0",
"yargs": "17.3.1"
},
"devDependencies": {
"chai": "^4.3.4",
"mocha": "^8.3.2"
"mocha": "9.2.0"
}
}
+7
View File
@@ -44,6 +44,9 @@ function buildCACert(keys, options, caCert = null) {
digitalSignature: true,
critical: true,
cRLSign: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true
},
{
name: 'subjectKeyIdentifier',
@@ -60,6 +63,10 @@ function buildCACert(keys, options, caCert = null) {
name: 'extKeyUsage',
serverAuth: true,
critical: true,
clientAuth: true,
codeSigning: true,
emailProtection: true,
timeStamping: true
});
}
+13
View File
@@ -69,6 +69,8 @@ const argv = yargs
basePath: argv.path,
commonName: argv['common-name'],
country: argv.country,
locality: argv.locality,
state: argv.state,
expired: argv.expired,
organizations: argv.org,
organizationalUnits: argv['org-unit'],
@@ -103,6 +105,8 @@ const argv = yargs
basePath: argv.path,
commonName: argv['common-name'],
country: argv.country,
locality: argv.locality,
state: argv.state,
expired: argv.expired,
rootCaName: argv['root-ca-name'],
organizations: argv.org,
@@ -158,6 +162,13 @@ const argv = yargs
default: 'US',
requiresArg: true,
})
.option('locality', {
describe: 'Locality',
})
.option('state', {
alias: 'st',
describe: 'State',
})
.option('expired', {
alias: 'e',
describe: 'Create an expired certificate.',
@@ -240,6 +251,8 @@ const argv = yargs
.help('help')
.group('common-name', 'Creation Options:')
.group('country', 'Creation Options:')
.group('locality', 'Creation Options:')
.group('state', 'Creation Options:')
.group('expired', 'Creation Options:')
.group('org-unit', 'Creation Options:')
.group('org', 'Creation Options:')
+5 -3
View File
@@ -66,9 +66,7 @@ function buildServerCert(keys, caName, caCert, localhost, options) {
{
name: 'keyUsage',
digitalSignature: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true,
critical: true,
},
{
@@ -195,6 +193,10 @@ function createServerCert(
return;
}
// Adding a check for the common name to be populated
// with the name field if it is blank.
options.commonName = _.get(options, 'commonName', serverName);
const serverCertPath = path.join(serverDir, '/crt.pem');
const serverKeyPath = path.join(serverDir, '/key.pem');
const serverP12Path = path.join(serverDir, '/bundle.p12');
@@ -275,7 +277,7 @@ function createServerCert(
expired ? 'expired ' : ''
}server certificate was created and signed by ${caCertName}.`,
};
console.error(success.message);
console.log(success.message);
callback(null, success);
} else {
const err = {
+15
View File
@@ -33,6 +33,21 @@ function createSubjectAttributes(options) {
});
}
const l = _.get(options, 'locality');
if (l) {
attrs.push({
shortName: 'L',
value: l,
});
}
const st = _.get(options, 'state');
if(st) {
attrs.push({
shortName: 'ST',
value: st,
});
}
return attrs;
}
-2
View File
@@ -41,9 +41,7 @@ function buildUserCert(keys, options, caCert) {
{
name: 'keyUsage',
digitalSignature: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true,
critical: true,
},
{
+38
View File
@@ -55,6 +55,26 @@ describe('Testing MADCert', function() {
});
});
it('Create Server Cert with locality and state', function(done) {
try {
certs.createServerCert('Server Locality and State', 'ca-cert-2', false, {
locality: 'Baltimore',
state: 'Maryland',
basePath: global.pkiPath,
expired: false,
rootCaName: 'CA Cert',
});
const created = fs.pathExistsSync(
path.join(global.pkiPath, 'ca-cert-2/servers/server-locality-and-state/crt.pem')
);
expect(created).to.be.true;
done();
} catch (e) {
done(e);
}
});
it('Create Server Cert with start and expiration dates', function(done) {
try {
certs.createServerCert('Server Valid From and To', 'ca-cert-2', false, {
@@ -162,6 +182,24 @@ describe('Testing MADCert', function() {
}
});
it('Create User Cert with locality and state', function(done) {
try {
certs.createUserCert('User locality and state', caName, {
locality: 'Baltimore',
state: 'Maryland',
basePath: global.pkiPath,
expired: false,
});
const created = fs.pathExistsSync(
path.join(global.pkiPath, caDir, 'users/user-locality-and-state/crt.pem')
);
expect(created).to.be.true;
done();
} catch (e) {
done(e);
}
});
it('Create User Cert with expiration before start should not be created', function(done) {
try {
certs.createUserCert('User Valid To before From', caName, {