Compare commits

..
9 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
8 changed files with 100 additions and 10 deletions

No files matched your search

+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|
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "madcert",
"version": "2.3.1",
"version": "2.5.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "madcert",
"version": "2.3.1",
"version": "2.5.0",
"license": "MIT",
"dependencies": {
"date-fns": "^2.19.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "madcert",
"version": "2.3.1",
"version": "2.5.0",
"description": "Make a Development Cert",
"engines": {
"node": ">=10.16.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:')
+1 -1
View File
@@ -277,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;
}
+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, {