node-opcua-pki 2.15.2 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ignore +6 -6
- package/.prettierrc +3 -3
- package/LICENSE +21 -21
- package/bin/crypto_create_CA.js +4 -2
- package/bin/crypto_create_CA_config.example.js +18 -18
- package/bin/install_prerequisite.js +9 -9
- package/dist/crypto_create_CA.d.ts +2 -2
- package/dist/crypto_create_CA.js +849 -849
- package/dist/index.d.ts +6 -6
- package/dist/index.js +43 -39
- package/dist/index.js.map +1 -1
- package/dist/misc/applicationurn.d.ts +1 -1
- package/dist/misc/applicationurn.js +45 -45
- package/dist/misc/hostname.d.ts +8 -8
- package/dist/misc/hostname.js +102 -102
- package/dist/misc/install_prerequisite.d.ts +9 -9
- package/dist/misc/install_prerequisite.js +359 -359
- package/dist/misc/install_prerequisite.js.map +1 -1
- package/dist/misc/subject.d.ts +21 -21
- package/dist/misc/subject.js +90 -90
- package/dist/pki/certificate_authority.d.ts +61 -61
- package/dist/pki/certificate_authority.js +480 -480
- package/dist/pki/certificate_manager.d.ts +144 -144
- package/dist/pki/certificate_manager.js +890 -890
- package/dist/pki/common.d.ts +5 -5
- package/dist/pki/common.js +2 -2
- package/dist/pki/templates/ca_config_template.cnf.d.ts +2 -2
- package/dist/pki/templates/ca_config_template.cnf.js +129 -129
- package/dist/pki/templates/simple_config_template.cnf.d.ts +2 -2
- package/dist/pki/templates/simple_config_template.cnf.js +75 -75
- package/dist/pki/toolbox.d.ts +159 -159
- package/dist/pki/toolbox.js +669 -669
- package/dist/pki/toolbox_pfx.js +18 -18
- package/lib/crypto_create_CA.ts +1155 -1155
- package/lib/index.ts +27 -27
- package/lib/misc/applicationurn.ts +44 -44
- package/lib/misc/hostname.ts +89 -89
- package/lib/misc/install_prerequisite.ts +450 -450
- package/lib/misc/subject.ts +110 -110
- package/lib/pki/common.ts +5 -5
- package/lib/pki/templates/ca_config_template.cnf.ts +129 -129
- package/lib/pki/templates/simple_config_template.cnf.ts +75 -75
- package/lib/pki/toolbox_pfx.ts +19 -19
- package/package.json +89 -89
- package/readme.md +143 -143
- package/tsconfig.json +20 -20
package/lib/misc/subject.ts
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
2
|
-
// node-opcua-pki
|
|
3
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
4
|
-
// Copyright (c) 2014-2021 - Etienne Rossignon - etienne.rossignon (at) gadz.org
|
|
5
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
6
|
-
//
|
|
7
|
-
// This project is licensed under the terms of the MIT license.
|
|
8
|
-
//
|
|
9
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
10
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
11
|
-
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
-
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
13
|
-
//
|
|
14
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
15
|
-
// Software.
|
|
16
|
-
//
|
|
17
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
18
|
-
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
-
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
20
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
22
|
-
|
|
23
|
-
export interface SubjectOptions {
|
|
24
|
-
commonName?: string;
|
|
25
|
-
organization?: string;
|
|
26
|
-
organizationalUnit?: string;
|
|
27
|
-
locality?: string;
|
|
28
|
-
state?: string;
|
|
29
|
-
country?: string;
|
|
30
|
-
domainComponent?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const _keys = {
|
|
34
|
-
C: "country",
|
|
35
|
-
CN: "commonName",
|
|
36
|
-
DC: "domainComponent",
|
|
37
|
-
L: "locality",
|
|
38
|
-
O: "organization",
|
|
39
|
-
OU: "organizationalUnit",
|
|
40
|
-
ST: "state",
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export class Subject implements SubjectOptions {
|
|
44
|
-
public readonly commonName?: string;
|
|
45
|
-
public readonly organization?: string;
|
|
46
|
-
public readonly organizationalUnit?: string;
|
|
47
|
-
public readonly locality?: string;
|
|
48
|
-
public readonly state?: string;
|
|
49
|
-
public readonly country?: string;
|
|
50
|
-
public readonly domainComponent?: string;
|
|
51
|
-
|
|
52
|
-
constructor(options: SubjectOptions | string) {
|
|
53
|
-
if (typeof options === "string") {
|
|
54
|
-
options = Subject.parse(options);
|
|
55
|
-
}
|
|
56
|
-
this.commonName = options.commonName;
|
|
57
|
-
this.organization = options.organization;
|
|
58
|
-
this.organizationalUnit = options.organizationalUnit;
|
|
59
|
-
this.locality = options.locality;
|
|
60
|
-
this.state = options.state;
|
|
61
|
-
this.country = options.country;
|
|
62
|
-
this.domainComponent = options.domainComponent;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public static parse(str: string): SubjectOptions {
|
|
66
|
-
const elements = str.split(/\/(?=[^/]*?=)/);
|
|
67
|
-
const options: Record<string, unknown> = {};
|
|
68
|
-
|
|
69
|
-
elements.forEach((element: string) => {
|
|
70
|
-
if (element.length === 0) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const s: string[] = element.split("=");
|
|
74
|
-
|
|
75
|
-
if (s.length !== 2) {
|
|
76
|
-
throw new Error("invalid format for " + element);
|
|
77
|
-
}
|
|
78
|
-
const longName = (_keys as any)[s[0]];
|
|
79
|
-
const value = s[1];
|
|
80
|
-
options[longName] = Buffer.from(value, "ascii").toString("utf8");
|
|
81
|
-
});
|
|
82
|
-
return options as SubjectOptions;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public toString() {
|
|
86
|
-
let tmp = "";
|
|
87
|
-
if (this.country) {
|
|
88
|
-
tmp += "/C=" + this.country;
|
|
89
|
-
}
|
|
90
|
-
if (this.state) {
|
|
91
|
-
tmp += "/ST=" + this.state;
|
|
92
|
-
}
|
|
93
|
-
if (this.locality) {
|
|
94
|
-
tmp += "/L=" + this.locality;
|
|
95
|
-
}
|
|
96
|
-
if (this.organization) {
|
|
97
|
-
tmp += "/O=" + this.organization;
|
|
98
|
-
}
|
|
99
|
-
if (this.organizationalUnit) {
|
|
100
|
-
tmp += "/OU=" + this.organization;
|
|
101
|
-
}
|
|
102
|
-
if (this.commonName) {
|
|
103
|
-
tmp += "/CN=" + this.commonName;
|
|
104
|
-
}
|
|
105
|
-
if (this.domainComponent) {
|
|
106
|
-
tmp += "/DC=" + this.domainComponent;
|
|
107
|
-
}
|
|
108
|
-
return tmp;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// node-opcua-pki
|
|
3
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
// Copyright (c) 2014-2021 - Etienne Rossignon - etienne.rossignon (at) gadz.org
|
|
5
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
6
|
+
//
|
|
7
|
+
// This project is licensed under the terms of the MIT license.
|
|
8
|
+
//
|
|
9
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
10
|
+
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
11
|
+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
13
|
+
//
|
|
14
|
+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
15
|
+
// Software.
|
|
16
|
+
//
|
|
17
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
18
|
+
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
20
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
export interface SubjectOptions {
|
|
24
|
+
commonName?: string;
|
|
25
|
+
organization?: string;
|
|
26
|
+
organizationalUnit?: string;
|
|
27
|
+
locality?: string;
|
|
28
|
+
state?: string;
|
|
29
|
+
country?: string;
|
|
30
|
+
domainComponent?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const _keys = {
|
|
34
|
+
C: "country",
|
|
35
|
+
CN: "commonName",
|
|
36
|
+
DC: "domainComponent",
|
|
37
|
+
L: "locality",
|
|
38
|
+
O: "organization",
|
|
39
|
+
OU: "organizationalUnit",
|
|
40
|
+
ST: "state",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export class Subject implements SubjectOptions {
|
|
44
|
+
public readonly commonName?: string;
|
|
45
|
+
public readonly organization?: string;
|
|
46
|
+
public readonly organizationalUnit?: string;
|
|
47
|
+
public readonly locality?: string;
|
|
48
|
+
public readonly state?: string;
|
|
49
|
+
public readonly country?: string;
|
|
50
|
+
public readonly domainComponent?: string;
|
|
51
|
+
|
|
52
|
+
constructor(options: SubjectOptions | string) {
|
|
53
|
+
if (typeof options === "string") {
|
|
54
|
+
options = Subject.parse(options);
|
|
55
|
+
}
|
|
56
|
+
this.commonName = options.commonName;
|
|
57
|
+
this.organization = options.organization;
|
|
58
|
+
this.organizationalUnit = options.organizationalUnit;
|
|
59
|
+
this.locality = options.locality;
|
|
60
|
+
this.state = options.state;
|
|
61
|
+
this.country = options.country;
|
|
62
|
+
this.domainComponent = options.domainComponent;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public static parse(str: string): SubjectOptions {
|
|
66
|
+
const elements = str.split(/\/(?=[^/]*?=)/);
|
|
67
|
+
const options: Record<string, unknown> = {};
|
|
68
|
+
|
|
69
|
+
elements.forEach((element: string) => {
|
|
70
|
+
if (element.length === 0) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const s: string[] = element.split("=");
|
|
74
|
+
|
|
75
|
+
if (s.length !== 2) {
|
|
76
|
+
throw new Error("invalid format for " + element);
|
|
77
|
+
}
|
|
78
|
+
const longName = (_keys as any)[s[0]];
|
|
79
|
+
const value = s[1];
|
|
80
|
+
options[longName] = Buffer.from(value, "ascii").toString("utf8");
|
|
81
|
+
});
|
|
82
|
+
return options as SubjectOptions;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public toString() {
|
|
86
|
+
let tmp = "";
|
|
87
|
+
if (this.country) {
|
|
88
|
+
tmp += "/C=" + this.country;
|
|
89
|
+
}
|
|
90
|
+
if (this.state) {
|
|
91
|
+
tmp += "/ST=" + this.state;
|
|
92
|
+
}
|
|
93
|
+
if (this.locality) {
|
|
94
|
+
tmp += "/L=" + this.locality;
|
|
95
|
+
}
|
|
96
|
+
if (this.organization) {
|
|
97
|
+
tmp += "/O=" + this.organization;
|
|
98
|
+
}
|
|
99
|
+
if (this.organizationalUnit) {
|
|
100
|
+
tmp += "/OU=" + this.organization;
|
|
101
|
+
}
|
|
102
|
+
if (this.commonName) {
|
|
103
|
+
tmp += "/CN=" + this.commonName;
|
|
104
|
+
}
|
|
105
|
+
if (this.domainComponent) {
|
|
106
|
+
tmp += "/DC=" + this.domainComponent;
|
|
107
|
+
}
|
|
108
|
+
return tmp;
|
|
109
|
+
}
|
|
110
|
+
}
|
package/lib/pki/common.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type KeySize = 1024 | 2048 | 3072 | 4096;
|
|
2
|
-
export type Thumbprint = string;
|
|
3
|
-
export type Filename = string;
|
|
4
|
-
export type CertificateStatus = "unknown" | "trusted" | "rejected";
|
|
5
|
-
export type ErrorCallback = (err?: Error | null) => void;
|
|
1
|
+
export type KeySize = 1024 | 2048 | 3072 | 4096;
|
|
2
|
+
export type Thumbprint = string;
|
|
3
|
+
export type Filename = string;
|
|
4
|
+
export type CertificateStatus = "unknown" | "trusted" | "rejected";
|
|
5
|
+
export type ErrorCallback = (err?: Error | null) => void;
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
const config =
|
|
2
|
-
"#.........DO NOT MODIFY BY HAND .........................\n" +
|
|
3
|
-
"[ ca ]\n" +
|
|
4
|
-
"default_ca = CA_default\n" +
|
|
5
|
-
"[ CA_default ]\n" +
|
|
6
|
-
"dir = %%ROOT_FOLDER%% # the main CA folder\n" +
|
|
7
|
-
"certs = $dir/certs # where to store certificates\n" +
|
|
8
|
-
"new_certs_dir = $dir/certs #\n" +
|
|
9
|
-
"database = $dir/index.txt # the certificate database\n" +
|
|
10
|
-
"serial = $dir/serial # the serial number counter\n" +
|
|
11
|
-
"certificate = $dir/public/cacert.pem # The root CA certificate\n" +
|
|
12
|
-
"private_key = $dir/private/cakey.pem # the CA private key\n" +
|
|
13
|
-
"x509_extensions = usr_cert #\n" +
|
|
14
|
-
"default_days = 3650 # default validity : 10 years\n" +
|
|
15
|
-
"\n" +
|
|
16
|
-
"# default_md = sha1\n" +
|
|
17
|
-
"\n" +
|
|
18
|
-
"default_md = sha256 # The default digest algorithm\n" +
|
|
19
|
-
"\n" +
|
|
20
|
-
"preserve = no\n" +
|
|
21
|
-
"policy = policy_match\n" +
|
|
22
|
-
"# randfile = $dir/random.rnd\n" +
|
|
23
|
-
"# default_startdate = YYMMDDHHMMSSZ\n" +
|
|
24
|
-
"# default_enddate = YYMMDDHHMMSSZ\n" +
|
|
25
|
-
"crl_dir = $dir/crl\n" +
|
|
26
|
-
"crl_extensions = crl_ext\n" +
|
|
27
|
-
"crl = $dir/revocation_list.crl # the Revocation list\n" +
|
|
28
|
-
"crlnumber = $dir/crlnumber # CRL number file\n" +
|
|
29
|
-
"default_crl_days = 30\n" +
|
|
30
|
-
"default_crl_hours = 24\n" +
|
|
31
|
-
"#msie_hack\n" +
|
|
32
|
-
"\n" +
|
|
33
|
-
"[ policy_match ]\n" +
|
|
34
|
-
"countryName = optional\n" +
|
|
35
|
-
"stateOrProvinceName = optional\n" +
|
|
36
|
-
"localityName = optional\n" +
|
|
37
|
-
"organizationName = optional\n" +
|
|
38
|
-
"organizationalUnitName = optional\n" +
|
|
39
|
-
"commonName = optional\n" +
|
|
40
|
-
"emailAddress = optional\n" +
|
|
41
|
-
"\n" +
|
|
42
|
-
"[ req ]\n" +
|
|
43
|
-
"default_bits = 4096 # Size of keys\n" +
|
|
44
|
-
"default_keyfile = key.pem # name of generated keys\n" +
|
|
45
|
-
"distinguished_name = req_distinguished_name\n" +
|
|
46
|
-
"attributes = req_attributes\n" +
|
|
47
|
-
"x509_extensions = v3_ca\n" +
|
|
48
|
-
"#input_password\n" +
|
|
49
|
-
"#output_password\n" +
|
|
50
|
-
"string_mask = nombstr # permitted characters\n" +
|
|
51
|
-
"req_extensions = v3_req\n" +
|
|
52
|
-
"\n" +
|
|
53
|
-
"[ req_distinguished_name ]\n" +
|
|
54
|
-
"\n" +
|
|
55
|
-
"#0 countryName = Country Name (2 letter code)\n" +
|
|
56
|
-
"# countryName_default = FR\n" +
|
|
57
|
-
"# countryName_min = 2\n" +
|
|
58
|
-
"# countryName_max = 2\n" +
|
|
59
|
-
"# stateOrProvinceName = State or Province Name (full name)\n" +
|
|
60
|
-
"# stateOrProvinceName_default = Ile de France\n" +
|
|
61
|
-
"# localityName = Locality Name (city, district)\n" +
|
|
62
|
-
"# localityName_default = Paris\n" +
|
|
63
|
-
"organizationName = Organization Name (company)\n" +
|
|
64
|
-
"organizationName_default = NodeOPCUA\n" +
|
|
65
|
-
"# organizationalUnitName = Organizational Unit Name (department, division)\n" +
|
|
66
|
-
"# organizationalUnitName_default = R&D\n" +
|
|
67
|
-
"commonName = Common Name (hostname, FQDN, IP, or your name)\n" +
|
|
68
|
-
"commonName_max = 256\n" +
|
|
69
|
-
"commonName_default = NodeOPCUA\n" +
|
|
70
|
-
"# emailAddress = Email Address\n" +
|
|
71
|
-
"# emailAddress_max = 40\n" +
|
|
72
|
-
"# emailAddress_default = node-opcua (at) node-opcua (dot) com\n" +
|
|
73
|
-
"\n" +
|
|
74
|
-
"[ req_attributes ]\n" +
|
|
75
|
-
"#challengePassword = A challenge password\n" +
|
|
76
|
-
"#challengePassword_min = 4\n" +
|
|
77
|
-
"#challengePassword_max = 20\n" +
|
|
78
|
-
"#unstructuredName = An optional company name\n" +
|
|
79
|
-
"[ usr_cert ]\n" +
|
|
80
|
-
"basicConstraints = critical, CA:FALSE\n" +
|
|
81
|
-
"subjectKeyIdentifier = hash\n" +
|
|
82
|
-
"authorityKeyIdentifier = keyid,issuer:always\n" +
|
|
83
|
-
"#authorityKeyIdentifier = keyid\n" +
|
|
84
|
-
"subjectAltName = $ENV::ALTNAME\n" +
|
|
85
|
-
"# issuerAltName = issuer:copy\n" +
|
|
86
|
-
"nsComment = ''OpenSSL Generated Certificate''\n" +
|
|
87
|
-
"#nsCertType = client, email, objsign for ''everything including object signing''\n" +
|
|
88
|
-
"#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem\n" +
|
|
89
|
-
"#nsBaseUrl =\n" +
|
|
90
|
-
"#nsRenewalUrl =\n" +
|
|
91
|
-
"#nsCaPolicyUrl =\n" +
|
|
92
|
-
"#nsSslServerName =\n" +
|
|
93
|
-
"keyUsage = critical, digitalSignature, nonRepudiation," +
|
|
94
|
-
" keyEncipherment, dataEncipherment, keyAgreement, keyCertSign\n" +
|
|
95
|
-
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
96
|
-
"\n" +
|
|
97
|
-
"[ v3_req ]\n" +
|
|
98
|
-
"basicConstraints = critical, CA:FALSE\n" +
|
|
99
|
-
"keyUsage = nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement\n" +
|
|
100
|
-
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
101
|
-
"subjectAltName = $ENV::ALTNAME\n" +
|
|
102
|
-
"nsComment = \"CA Generated by Node-OPCUA Certificate utility using openssl\"\n" +
|
|
103
|
-
"[ v3_ca ]\n" +
|
|
104
|
-
"subjectKeyIdentifier = hash\n" +
|
|
105
|
-
"authorityKeyIdentifier = keyid:always,issuer:always\n" +
|
|
106
|
-
"# authorityKeyIdentifier = keyid\n" +
|
|
107
|
-
"basicConstraints = CA:TRUE\n" +
|
|
108
|
-
"keyUsage = critical, cRLSign, keyCertSign\n" +
|
|
109
|
-
"nsComment = \"CA Certificate generated by Node-OPCUA Certificate utility using openssl\"\n" +
|
|
110
|
-
"#nsCertType = sslCA, emailCA\n" +
|
|
111
|
-
"#subjectAltName = email:copy\n" +
|
|
112
|
-
"#issuerAltName = issuer:copy\n" +
|
|
113
|
-
"#obj = DER:02:03\n" +
|
|
114
|
-
"crlDistributionPoints = @crl_info\n" +
|
|
115
|
-
"[ crl_info ]\n" +
|
|
116
|
-
"URI.0 = http://localhost:8900/crl.pem\n" +
|
|
117
|
-
"[ v3_selfsigned]\n" +
|
|
118
|
-
"basicConstraints = critical, CA:FALSE\n" +
|
|
119
|
-
"keyUsage = nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement\n" +
|
|
120
|
-
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
121
|
-
"nsComment = \"Self-signed certificate, generated by NodeOPCUA\"\n" +
|
|
122
|
-
"subjectAltName = $ENV::ALTNAME\n" +
|
|
123
|
-
"\n" +
|
|
124
|
-
"[ crl_ext ]\n" +
|
|
125
|
-
"#issuerAltName = issuer:copy\n" +
|
|
126
|
-
"authorityKeyIdentifier = keyid:always,issuer:always\n" +
|
|
127
|
-
"#authorityInfoAccess = @issuer_info";
|
|
128
|
-
|
|
129
|
-
export default config;
|
|
1
|
+
const config =
|
|
2
|
+
"#.........DO NOT MODIFY BY HAND .........................\n" +
|
|
3
|
+
"[ ca ]\n" +
|
|
4
|
+
"default_ca = CA_default\n" +
|
|
5
|
+
"[ CA_default ]\n" +
|
|
6
|
+
"dir = %%ROOT_FOLDER%% # the main CA folder\n" +
|
|
7
|
+
"certs = $dir/certs # where to store certificates\n" +
|
|
8
|
+
"new_certs_dir = $dir/certs #\n" +
|
|
9
|
+
"database = $dir/index.txt # the certificate database\n" +
|
|
10
|
+
"serial = $dir/serial # the serial number counter\n" +
|
|
11
|
+
"certificate = $dir/public/cacert.pem # The root CA certificate\n" +
|
|
12
|
+
"private_key = $dir/private/cakey.pem # the CA private key\n" +
|
|
13
|
+
"x509_extensions = usr_cert #\n" +
|
|
14
|
+
"default_days = 3650 # default validity : 10 years\n" +
|
|
15
|
+
"\n" +
|
|
16
|
+
"# default_md = sha1\n" +
|
|
17
|
+
"\n" +
|
|
18
|
+
"default_md = sha256 # The default digest algorithm\n" +
|
|
19
|
+
"\n" +
|
|
20
|
+
"preserve = no\n" +
|
|
21
|
+
"policy = policy_match\n" +
|
|
22
|
+
"# randfile = $dir/random.rnd\n" +
|
|
23
|
+
"# default_startdate = YYMMDDHHMMSSZ\n" +
|
|
24
|
+
"# default_enddate = YYMMDDHHMMSSZ\n" +
|
|
25
|
+
"crl_dir = $dir/crl\n" +
|
|
26
|
+
"crl_extensions = crl_ext\n" +
|
|
27
|
+
"crl = $dir/revocation_list.crl # the Revocation list\n" +
|
|
28
|
+
"crlnumber = $dir/crlnumber # CRL number file\n" +
|
|
29
|
+
"default_crl_days = 30\n" +
|
|
30
|
+
"default_crl_hours = 24\n" +
|
|
31
|
+
"#msie_hack\n" +
|
|
32
|
+
"\n" +
|
|
33
|
+
"[ policy_match ]\n" +
|
|
34
|
+
"countryName = optional\n" +
|
|
35
|
+
"stateOrProvinceName = optional\n" +
|
|
36
|
+
"localityName = optional\n" +
|
|
37
|
+
"organizationName = optional\n" +
|
|
38
|
+
"organizationalUnitName = optional\n" +
|
|
39
|
+
"commonName = optional\n" +
|
|
40
|
+
"emailAddress = optional\n" +
|
|
41
|
+
"\n" +
|
|
42
|
+
"[ req ]\n" +
|
|
43
|
+
"default_bits = 4096 # Size of keys\n" +
|
|
44
|
+
"default_keyfile = key.pem # name of generated keys\n" +
|
|
45
|
+
"distinguished_name = req_distinguished_name\n" +
|
|
46
|
+
"attributes = req_attributes\n" +
|
|
47
|
+
"x509_extensions = v3_ca\n" +
|
|
48
|
+
"#input_password\n" +
|
|
49
|
+
"#output_password\n" +
|
|
50
|
+
"string_mask = nombstr # permitted characters\n" +
|
|
51
|
+
"req_extensions = v3_req\n" +
|
|
52
|
+
"\n" +
|
|
53
|
+
"[ req_distinguished_name ]\n" +
|
|
54
|
+
"\n" +
|
|
55
|
+
"#0 countryName = Country Name (2 letter code)\n" +
|
|
56
|
+
"# countryName_default = FR\n" +
|
|
57
|
+
"# countryName_min = 2\n" +
|
|
58
|
+
"# countryName_max = 2\n" +
|
|
59
|
+
"# stateOrProvinceName = State or Province Name (full name)\n" +
|
|
60
|
+
"# stateOrProvinceName_default = Ile de France\n" +
|
|
61
|
+
"# localityName = Locality Name (city, district)\n" +
|
|
62
|
+
"# localityName_default = Paris\n" +
|
|
63
|
+
"organizationName = Organization Name (company)\n" +
|
|
64
|
+
"organizationName_default = NodeOPCUA\n" +
|
|
65
|
+
"# organizationalUnitName = Organizational Unit Name (department, division)\n" +
|
|
66
|
+
"# organizationalUnitName_default = R&D\n" +
|
|
67
|
+
"commonName = Common Name (hostname, FQDN, IP, or your name)\n" +
|
|
68
|
+
"commonName_max = 256\n" +
|
|
69
|
+
"commonName_default = NodeOPCUA\n" +
|
|
70
|
+
"# emailAddress = Email Address\n" +
|
|
71
|
+
"# emailAddress_max = 40\n" +
|
|
72
|
+
"# emailAddress_default = node-opcua (at) node-opcua (dot) com\n" +
|
|
73
|
+
"\n" +
|
|
74
|
+
"[ req_attributes ]\n" +
|
|
75
|
+
"#challengePassword = A challenge password\n" +
|
|
76
|
+
"#challengePassword_min = 4\n" +
|
|
77
|
+
"#challengePassword_max = 20\n" +
|
|
78
|
+
"#unstructuredName = An optional company name\n" +
|
|
79
|
+
"[ usr_cert ]\n" +
|
|
80
|
+
"basicConstraints = critical, CA:FALSE\n" +
|
|
81
|
+
"subjectKeyIdentifier = hash\n" +
|
|
82
|
+
"authorityKeyIdentifier = keyid,issuer:always\n" +
|
|
83
|
+
"#authorityKeyIdentifier = keyid\n" +
|
|
84
|
+
"subjectAltName = $ENV::ALTNAME\n" +
|
|
85
|
+
"# issuerAltName = issuer:copy\n" +
|
|
86
|
+
"nsComment = ''OpenSSL Generated Certificate''\n" +
|
|
87
|
+
"#nsCertType = client, email, objsign for ''everything including object signing''\n" +
|
|
88
|
+
"#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem\n" +
|
|
89
|
+
"#nsBaseUrl =\n" +
|
|
90
|
+
"#nsRenewalUrl =\n" +
|
|
91
|
+
"#nsCaPolicyUrl =\n" +
|
|
92
|
+
"#nsSslServerName =\n" +
|
|
93
|
+
"keyUsage = critical, digitalSignature, nonRepudiation," +
|
|
94
|
+
" keyEncipherment, dataEncipherment, keyAgreement, keyCertSign\n" +
|
|
95
|
+
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
96
|
+
"\n" +
|
|
97
|
+
"[ v3_req ]\n" +
|
|
98
|
+
"basicConstraints = critical, CA:FALSE\n" +
|
|
99
|
+
"keyUsage = nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement\n" +
|
|
100
|
+
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
101
|
+
"subjectAltName = $ENV::ALTNAME\n" +
|
|
102
|
+
"nsComment = \"CA Generated by Node-OPCUA Certificate utility using openssl\"\n" +
|
|
103
|
+
"[ v3_ca ]\n" +
|
|
104
|
+
"subjectKeyIdentifier = hash\n" +
|
|
105
|
+
"authorityKeyIdentifier = keyid:always,issuer:always\n" +
|
|
106
|
+
"# authorityKeyIdentifier = keyid\n" +
|
|
107
|
+
"basicConstraints = CA:TRUE\n" +
|
|
108
|
+
"keyUsage = critical, cRLSign, keyCertSign\n" +
|
|
109
|
+
"nsComment = \"CA Certificate generated by Node-OPCUA Certificate utility using openssl\"\n" +
|
|
110
|
+
"#nsCertType = sslCA, emailCA\n" +
|
|
111
|
+
"#subjectAltName = email:copy\n" +
|
|
112
|
+
"#issuerAltName = issuer:copy\n" +
|
|
113
|
+
"#obj = DER:02:03\n" +
|
|
114
|
+
"crlDistributionPoints = @crl_info\n" +
|
|
115
|
+
"[ crl_info ]\n" +
|
|
116
|
+
"URI.0 = http://localhost:8900/crl.pem\n" +
|
|
117
|
+
"[ v3_selfsigned]\n" +
|
|
118
|
+
"basicConstraints = critical, CA:FALSE\n" +
|
|
119
|
+
"keyUsage = nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement\n" +
|
|
120
|
+
"extendedKeyUsage = critical,serverAuth ,clientAuth\n" +
|
|
121
|
+
"nsComment = \"Self-signed certificate, generated by NodeOPCUA\"\n" +
|
|
122
|
+
"subjectAltName = $ENV::ALTNAME\n" +
|
|
123
|
+
"\n" +
|
|
124
|
+
"[ crl_ext ]\n" +
|
|
125
|
+
"#issuerAltName = issuer:copy\n" +
|
|
126
|
+
"authorityKeyIdentifier = keyid:always,issuer:always\n" +
|
|
127
|
+
"#authorityInfoAccess = @issuer_info";
|
|
128
|
+
|
|
129
|
+
export default config;
|