node-opcua-pki 3.0.2 → 3.1.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 +5 -5
- package/LICENSE +22 -22
- package/bin/crypto_create_CA.js +0 -0
- 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 +897 -897
- package/dist/index.d.ts +6 -6
- package/dist/index.js +44 -44
- package/dist/misc/applicationurn.d.ts +1 -1
- package/dist/misc/applicationurn.js +46 -46
- 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 +363 -360
- package/dist/misc/install_prerequisite.js.map +1 -1
- package/dist/misc/subject.d.ts +26 -26
- package/dist/misc/subject.js +121 -121
- package/dist/pki/certificate_authority.d.ts +61 -61
- package/dist/pki/certificate_authority.js +481 -481
- package/dist/pki/certificate_manager.d.ts +144 -144
- package/dist/pki/certificate_manager.js +883 -883
- package/dist/pki/certificate_manager.js.map +1 -1
- 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 +160 -160
- package/dist/pki/toolbox.js +699 -699
- package/dist/pki/toolbox_pfx.js +18 -18
- package/lib/crypto_create_CA.ts +1135 -1135
- package/lib/index.ts +28 -28
- package/lib/misc/applicationurn.ts +45 -45
- package/lib/misc/hostname.ts +89 -89
- package/lib/misc/install_prerequisite.ts +454 -454
- package/lib/misc/subject.ts +141 -141
- package/lib/pki/certificate_manager.ts +1 -1
- 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 +214 -214
- package/tsconfig.json +20 -20
- package/dist/misc/fs.d.ts +0 -24
- package/dist/misc/fs.js +0 -21
- package/dist/misc/fs.js.map +0 -1
- package/dist/misc/get_default_filesystem.d.ts +0 -2
- package/dist/misc/get_default_filesystem.js +0 -9
- package/dist/misc/get_default_filesystem.js.map +0 -1
package/readme.md
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
### node-opcua-pki
|
|
2
|
-
|
|
3
|
-
[](https://github.com/node-opcua/node-opcua-pki/actions/workflows/ci.yml)
|
|
4
|
-
[](https://coveralls.io/github/node-opcua/node-opcua-pki?branch=master)
|
|
5
|
-
[](https://packagephobia.com/result?p=node-opcua-pki)
|
|
6
|
-
[](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-pki?ref=badge_shield)
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
##### install globally
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
$ npm install -g node-opcua-pki
|
|
14
|
-
$ crypto_create_CA --help
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
##### use with npx
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
npx node-opcua-pki --help
|
|
21
|
-
npx node-opcua-pki certificate --help
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Note: see https://reference.opcfoundation.org/GDS/docs/F.1/
|
|
25
|
-
|
|
26
|
-
# commands
|
|
27
|
-
|
|
28
|
-
| command | Help |
|
|
29
|
-
| ----------- | ----------------------------------------------- |
|
|
30
|
-
| demo | create default certificate for node-opcua demos |
|
|
31
|
-
| createCA | create a Certificate Authority |
|
|
32
|
-
| createPKI | create a Public Key Infrastructure |
|
|
33
|
-
| certificate | create a new certificate |
|
|
34
|
-
| csr | create a new certificate signing request(CSR) |
|
|
35
|
-
| sign | sign a CSR and generate a certificate |
|
|
36
|
-
| revoke | revoke an existing certificate |
|
|
37
|
-
| dump | display a certificate |
|
|
38
|
-
| toder | convert a certificate to a DER format |
|
|
39
|
-
| fingerprint | print the certificate fingerprint |
|
|
40
|
-
|
|
41
|
-
Options:
|
|
42
|
-
--help display help
|
|
43
|
-
|
|
44
|
-
## create a PKI
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
node-opcua-pki createPKI
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Options:
|
|
51
|
-
|
|
52
|
-
| option | description | type | default |
|
|
53
|
-
| -------------------------- | -------------------------------------------------- | --------- | ------------------------------- |
|
|
54
|
-
| -r, --root | the location of the Certificate folder | [string] | [default: "{CWD}/certificates"] |
|
|
55
|
-
| --PKIFolder | the location of the Public Key Infrastructure | [string] | [default: "{root}/PKI"] |
|
|
56
|
-
| -k, --keySize, --keyLength | the private key size in bits (1024,2048,3072,4096) | [number] | [default: 2048] |
|
|
57
|
-
| -s, --silent | minimize output | [boolean] | [default: false] |
|
|
58
|
-
|
|
59
|
-
The result
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
└─ 📂certificates
|
|
63
|
-
└─📂PKI
|
|
64
|
-
├─📂issuers
|
|
65
|
-
│ ├─📂certs contains known Certificate Authorities' certificates
|
|
66
|
-
│ └─📂crl contains Certificate Revocation List associates with the CA Certificates
|
|
67
|
-
├─📂own
|
|
68
|
-
│ ├─📂certs where to store generated public certificates generated for the private key.
|
|
69
|
-
│ └─📂private
|
|
70
|
-
│ └─🔐private_key.pem the private key in PEM format
|
|
71
|
-
├─📂rejected contains certificates that have been rejected.
|
|
72
|
-
└─📂trusted
|
|
73
|
-
├─📂certs contains the X.509 v3 Certificates that are trusted.
|
|
74
|
-
└─📂crl contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## create a Certificate Signing Request (CSR)
|
|
78
|
-
|
|
79
|
-
Options:
|
|
80
|
-
| option | description | type | default |
|
|
81
|
-
|---------------------|-------------------------------------------------|--------|-----------------------------------------------|
|
|
82
|
-
|-a, --applicationUri |the application URI |[string]|[default: "urn:{hostname}:Node-OPCUA-Server"] |
|
|
83
|
-
|-o, --output | the name of the generated signing_request |[string]|[default: "my_certificate_signing_request.csr"]|
|
|
84
|
-
|--dns | the list of valid domain name (comma separated) |[string]|[default: "{hostname}"] |
|
|
85
|
-
|--ip | the list of valid IPs (comma separated) |[string]|[default: ""] |
|
|
86
|
-
|--subject | the certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello )|[string]| [default: "/CN=Certificate"]|
|
|
87
|
-
|-r, --root | the location of the Certificate folder |[string]|[default: "{CWD}/certificates"] |
|
|
88
|
-
|--PKIFolder | the location of the Public Key Infrastructure |[string]|[default: "{root}/PKI"] |
|
|
89
|
-
|
|
90
|
-
## Create a certificate authority
|
|
91
|
-
|
|
92
|
-
| | | default value |
|
|
93
|
-
| -------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------- |
|
|
94
|
-
| `--subject` | the CA certificate subject | "/C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=NodeOPCUA-CA" |
|
|
95
|
-
| `--root`, `-r` | the location of the Certificate folder | "{CWD}/certificates" |
|
|
96
|
-
| ` --CAFolder`, `-c` | the location of the Certificate Authority folder | "{root}/CA"] |
|
|
97
|
-
| `--keySize`, `-k`, `--keyLength` | the private key size in bits (1024, 2048 ,3072, 4096)| |
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
The result
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
└─ 📂certificates
|
|
104
|
-
└─📂PKI
|
|
105
|
-
├─📂CA Certificate Authority
|
|
106
|
-
├─📂rejected The Certificate store contains certificates that have been rejected.
|
|
107
|
-
│ ├─📂certs Contains the X.509 v3 Certificates which have been rejected.
|
|
108
|
-
├─📂trusted The Certificate store contains trusted Certificates.
|
|
109
|
-
│ ├─📂certs Contains the X.509 v3 Certificates that are trusted.
|
|
110
|
-
│ └─📂crl Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
111
|
-
├─📂issuers The Certificate store contains the CA Certificates needed for validation.
|
|
112
|
-
│ ├─📂certs Contains the X.509 v3 Certificates that are needed for validation.
|
|
113
|
-
│ ├─📂crl Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## sign a signing request (requires a CA)
|
|
117
|
-
|
|
118
|
-
| option | description | type | default |
|
|
119
|
-
| -------------- | ------------------------------------------------ | ------------------- | ----------------------------------------------- |
|
|
120
|
-
| -i, --csr | the csr | [string] [required] | [default: "my_certificate_signing_request.csr"] |
|
|
121
|
-
| -o, --output | the name of the generated certificate | [string] [required] | [default: "my_certificate.pem"] |
|
|
122
|
-
| -v, --validity | the certificate validity in days | [number] | [default: 365] |
|
|
123
|
-
| -r, --root | the location of the Certificate folder | [string] | [default: "{CWD}/certificates"] |
|
|
124
|
-
| -c, --CAFolder | the location of the Certificate Authority folder | [string] | [default: "{root}/CA"] |
|
|
125
|
-
|
|
126
|
-
## demo command
|
|
127
|
-
|
|
128
|
-
this command creates a bunch of certificates with various characteristics for demo and testing purposes.
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
crypto_create_CA demo [--dev] [--silent] [--clean]
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Options:
|
|
135
|
-
|
|
136
|
-
| | | |
|
|
137
|
-
| ------------ | -------------------------------------------------------------- | ------------------ |
|
|
138
|
-
| --help | display help | |
|
|
139
|
-
| --dev | create all sort of fancy certificates for dev testing purposes | |
|
|
140
|
-
| --clean | Purge existing directory [use with care!] | |
|
|
141
|
-
| --silent, -s | minimize output | |
|
|
142
|
-
| --root, -r | the location of the Certificate folder | {CWD}/certificates |
|
|
143
|
-
|
|
144
|
-
Example:
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
$crypto_create_CA demo --dev
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
##### certificate command
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
$crypto_create_CA certificate --help
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Options:
|
|
157
|
-
|
|
158
|
-
| | | |
|
|
159
|
-
| -------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
160
|
-
| --help | display help | |
|
|
161
|
-
| --applicationUri, -a | the application URI | urn:{hostname}:Node-OPCUA-Server |
|
|
162
|
-
| --output, -o | the name of the generated certificate | my_certificate.pem |
|
|
163
|
-
| --selfSigned, -s | if true, the certificate will be self-signed | false |
|
|
164
|
-
| --validity, -v | the certificate validity in days | |
|
|
165
|
-
| --silent, -s | minimize output | |
|
|
166
|
-
| --root, -r | the location of the Certificate folder | {CWD}/certificates |
|
|
167
|
-
| --CAFolder, -c | the location of the Certificate Authority folder | {root}/CA |
|
|
168
|
-
| --PKIFolder, -p | the location of the Public Key Infrastructure | {root}/PKI |
|
|
169
|
-
| --privateKey, -p | optional:the private key to use to generate certificate | |
|
|
170
|
-
| --subject | the certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello ) | |
|
|
171
|
-
|
|
172
|
-
#### References
|
|
173
|
-
|
|
174
|
-
- https://www.entrust.com/wp-content/uploads/2013/05/pathvalidation_wp.pdf
|
|
175
|
-
- https://en.wikipedia.org/wiki/Certification_path_validation_algorithm
|
|
176
|
-
- https://tools.ietf.org/html/rfc5280
|
|
177
|
-
|
|
178
|
-
#### prerequisite:
|
|
179
|
-
|
|
180
|
-
This module requires OpenSSL or LibreSSL to be installed.
|
|
181
|
-
|
|
182
|
-
On Windows, a version of OpenSSL is automatically downloaded and installed at run time, if not present. You will need an internet connection open.
|
|
183
|
-
|
|
184
|
-
You need to install it on Linux, (or in your docker image), or on macOS
|
|
185
|
-
|
|
186
|
-
- on ubuntu/Debian:
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
apt install openssl
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
or alpine:
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
apk add openssl
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
#### support:
|
|
199
|
-
|
|
200
|
-
## Getting professional support
|
|
201
|
-
|
|
202
|
-
NodeOPCUA PKI is developed and maintained by sterfive.com.
|
|
203
|
-
|
|
204
|
-
To get professional support, consider subscribing to the node-opcua membership community:
|
|
205
|
-
|
|
206
|
-
[](https://support.sterfive.com)
|
|
207
|
-
|
|
208
|
-
or contact [sterfive](https://www.sterfive.com) for dedicated consulting and more advanced support.
|
|
209
|
-
|
|
210
|
-
## :heart: Supporting the development effort - Sponsors & Backers</span>
|
|
211
|
-
|
|
212
|
-
If you like node-opcua-pki and if you are relying on it in one of your projects, please consider becoming a backer and [sponsoring us](https://github.com/sponsors/node-opcua), this will help us to maintain a high-quality stack and constant evolution of this module.
|
|
213
|
-
|
|
214
|
-
If your company would like to participate and influence the development of future versions of node-opcua please contact [sterfive](mailto:contact@sterfive.com).
|
|
1
|
+
### node-opcua-pki
|
|
2
|
+
|
|
3
|
+
[](https://github.com/node-opcua/node-opcua-pki/actions/workflows/ci.yml)
|
|
4
|
+
[](https://coveralls.io/github/node-opcua/node-opcua-pki?branch=master)
|
|
5
|
+
[](https://packagephobia.com/result?p=node-opcua-pki)
|
|
6
|
+
[](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-pki?ref=badge_shield)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
##### install globally
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
$ npm install -g node-opcua-pki
|
|
14
|
+
$ crypto_create_CA --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
##### use with npx
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npx node-opcua-pki --help
|
|
21
|
+
npx node-opcua-pki certificate --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Note: see https://reference.opcfoundation.org/GDS/docs/F.1/
|
|
25
|
+
|
|
26
|
+
# commands
|
|
27
|
+
|
|
28
|
+
| command | Help |
|
|
29
|
+
| ----------- | ----------------------------------------------- |
|
|
30
|
+
| demo | create default certificate for node-opcua demos |
|
|
31
|
+
| createCA | create a Certificate Authority |
|
|
32
|
+
| createPKI | create a Public Key Infrastructure |
|
|
33
|
+
| certificate | create a new certificate |
|
|
34
|
+
| csr | create a new certificate signing request(CSR) |
|
|
35
|
+
| sign | sign a CSR and generate a certificate |
|
|
36
|
+
| revoke | revoke an existing certificate |
|
|
37
|
+
| dump | display a certificate |
|
|
38
|
+
| toder | convert a certificate to a DER format |
|
|
39
|
+
| fingerprint | print the certificate fingerprint |
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
--help display help
|
|
43
|
+
|
|
44
|
+
## create a PKI
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
node-opcua-pki createPKI
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Options:
|
|
51
|
+
|
|
52
|
+
| option | description | type | default |
|
|
53
|
+
| -------------------------- | -------------------------------------------------- | --------- | ------------------------------- |
|
|
54
|
+
| -r, --root | the location of the Certificate folder | [string] | [default: "{CWD}/certificates"] |
|
|
55
|
+
| --PKIFolder | the location of the Public Key Infrastructure | [string] | [default: "{root}/PKI"] |
|
|
56
|
+
| -k, --keySize, --keyLength | the private key size in bits (1024,2048,3072,4096) | [number] | [default: 2048] |
|
|
57
|
+
| -s, --silent | minimize output | [boolean] | [default: false] |
|
|
58
|
+
|
|
59
|
+
The result
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
└─ 📂certificates
|
|
63
|
+
└─📂PKI
|
|
64
|
+
├─📂issuers
|
|
65
|
+
│ ├─📂certs contains known Certificate Authorities' certificates
|
|
66
|
+
│ └─📂crl contains Certificate Revocation List associates with the CA Certificates
|
|
67
|
+
├─📂own
|
|
68
|
+
│ ├─📂certs where to store generated public certificates generated for the private key.
|
|
69
|
+
│ └─📂private
|
|
70
|
+
│ └─🔐private_key.pem the private key in PEM format
|
|
71
|
+
├─📂rejected contains certificates that have been rejected.
|
|
72
|
+
└─📂trusted
|
|
73
|
+
├─📂certs contains the X.509 v3 Certificates that are trusted.
|
|
74
|
+
└─📂crl contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## create a Certificate Signing Request (CSR)
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
| option | description | type | default |
|
|
81
|
+
|---------------------|-------------------------------------------------|--------|-----------------------------------------------|
|
|
82
|
+
|-a, --applicationUri |the application URI |[string]|[default: "urn:{hostname}:Node-OPCUA-Server"] |
|
|
83
|
+
|-o, --output | the name of the generated signing_request |[string]|[default: "my_certificate_signing_request.csr"]|
|
|
84
|
+
|--dns | the list of valid domain name (comma separated) |[string]|[default: "{hostname}"] |
|
|
85
|
+
|--ip | the list of valid IPs (comma separated) |[string]|[default: ""] |
|
|
86
|
+
|--subject | the certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello )|[string]| [default: "/CN=Certificate"]|
|
|
87
|
+
|-r, --root | the location of the Certificate folder |[string]|[default: "{CWD}/certificates"] |
|
|
88
|
+
|--PKIFolder | the location of the Public Key Infrastructure |[string]|[default: "{root}/PKI"] |
|
|
89
|
+
|
|
90
|
+
## Create a certificate authority
|
|
91
|
+
|
|
92
|
+
| | | default value |
|
|
93
|
+
| -------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------- |
|
|
94
|
+
| `--subject` | the CA certificate subject | "/C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=NodeOPCUA-CA" |
|
|
95
|
+
| `--root`, `-r` | the location of the Certificate folder | "{CWD}/certificates" |
|
|
96
|
+
| ` --CAFolder`, `-c` | the location of the Certificate Authority folder | "{root}/CA"] |
|
|
97
|
+
| `--keySize`, `-k`, `--keyLength` | the private key size in bits (1024, 2048 ,3072, 4096)| |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
The result
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
└─ 📂certificates
|
|
104
|
+
└─📂PKI
|
|
105
|
+
├─📂CA Certificate Authority
|
|
106
|
+
├─📂rejected The Certificate store contains certificates that have been rejected.
|
|
107
|
+
│ ├─📂certs Contains the X.509 v3 Certificates which have been rejected.
|
|
108
|
+
├─📂trusted The Certificate store contains trusted Certificates.
|
|
109
|
+
│ ├─📂certs Contains the X.509 v3 Certificates that are trusted.
|
|
110
|
+
│ └─📂crl Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
111
|
+
├─📂issuers The Certificate store contains the CA Certificates needed for validation.
|
|
112
|
+
│ ├─📂certs Contains the X.509 v3 Certificates that are needed for validation.
|
|
113
|
+
│ ├─📂crl Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## sign a signing request (requires a CA)
|
|
117
|
+
|
|
118
|
+
| option | description | type | default |
|
|
119
|
+
| -------------- | ------------------------------------------------ | ------------------- | ----------------------------------------------- |
|
|
120
|
+
| -i, --csr | the csr | [string] [required] | [default: "my_certificate_signing_request.csr"] |
|
|
121
|
+
| -o, --output | the name of the generated certificate | [string] [required] | [default: "my_certificate.pem"] |
|
|
122
|
+
| -v, --validity | the certificate validity in days | [number] | [default: 365] |
|
|
123
|
+
| -r, --root | the location of the Certificate folder | [string] | [default: "{CWD}/certificates"] |
|
|
124
|
+
| -c, --CAFolder | the location of the Certificate Authority folder | [string] | [default: "{root}/CA"] |
|
|
125
|
+
|
|
126
|
+
## demo command
|
|
127
|
+
|
|
128
|
+
this command creates a bunch of certificates with various characteristics for demo and testing purposes.
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
crypto_create_CA demo [--dev] [--silent] [--clean]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Options:
|
|
135
|
+
|
|
136
|
+
| | | |
|
|
137
|
+
| ------------ | -------------------------------------------------------------- | ------------------ |
|
|
138
|
+
| --help | display help | |
|
|
139
|
+
| --dev | create all sort of fancy certificates for dev testing purposes | |
|
|
140
|
+
| --clean | Purge existing directory [use with care!] | |
|
|
141
|
+
| --silent, -s | minimize output | |
|
|
142
|
+
| --root, -r | the location of the Certificate folder | {CWD}/certificates |
|
|
143
|
+
|
|
144
|
+
Example:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
$crypto_create_CA demo --dev
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
##### certificate command
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
$crypto_create_CA certificate --help
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Options:
|
|
157
|
+
|
|
158
|
+
| | | |
|
|
159
|
+
| -------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
160
|
+
| --help | display help | |
|
|
161
|
+
| --applicationUri, -a | the application URI | urn:{hostname}:Node-OPCUA-Server |
|
|
162
|
+
| --output, -o | the name of the generated certificate | my_certificate.pem |
|
|
163
|
+
| --selfSigned, -s | if true, the certificate will be self-signed | false |
|
|
164
|
+
| --validity, -v | the certificate validity in days | |
|
|
165
|
+
| --silent, -s | minimize output | |
|
|
166
|
+
| --root, -r | the location of the Certificate folder | {CWD}/certificates |
|
|
167
|
+
| --CAFolder, -c | the location of the Certificate Authority folder | {root}/CA |
|
|
168
|
+
| --PKIFolder, -p | the location of the Public Key Infrastructure | {root}/PKI |
|
|
169
|
+
| --privateKey, -p | optional:the private key to use to generate certificate | |
|
|
170
|
+
| --subject | the certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello ) | |
|
|
171
|
+
|
|
172
|
+
#### References
|
|
173
|
+
|
|
174
|
+
- https://www.entrust.com/wp-content/uploads/2013/05/pathvalidation_wp.pdf
|
|
175
|
+
- https://en.wikipedia.org/wiki/Certification_path_validation_algorithm
|
|
176
|
+
- https://tools.ietf.org/html/rfc5280
|
|
177
|
+
|
|
178
|
+
#### prerequisite:
|
|
179
|
+
|
|
180
|
+
This module requires OpenSSL or LibreSSL to be installed.
|
|
181
|
+
|
|
182
|
+
On Windows, a version of OpenSSL is automatically downloaded and installed at run time, if not present. You will need an internet connection open.
|
|
183
|
+
|
|
184
|
+
You need to install it on Linux, (or in your docker image), or on macOS
|
|
185
|
+
|
|
186
|
+
- on ubuntu/Debian:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
apt install openssl
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
or alpine:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
apk add openssl
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### support:
|
|
199
|
+
|
|
200
|
+
## Getting professional support
|
|
201
|
+
|
|
202
|
+
NodeOPCUA PKI is developed and maintained by sterfive.com.
|
|
203
|
+
|
|
204
|
+
To get professional support, consider subscribing to the node-opcua membership community:
|
|
205
|
+
|
|
206
|
+
[](https://support.sterfive.com)
|
|
207
|
+
|
|
208
|
+
or contact [sterfive](https://www.sterfive.com) for dedicated consulting and more advanced support.
|
|
209
|
+
|
|
210
|
+
## :heart: Supporting the development effort - Sponsors & Backers</span>
|
|
211
|
+
|
|
212
|
+
If you like node-opcua-pki and if you are relying on it in one of your projects, please consider becoming a backer and [sponsoring us](https://github.com/sponsors/node-opcua), this will help us to maintain a high-quality stack and constant evolution of this module.
|
|
213
|
+
|
|
214
|
+
If your company would like to participate and influence the development of future versions of node-opcua please contact [sterfive](mailto:contact@sterfive.com).
|
package/tsconfig.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"skipLibCheck": true,
|
|
4
|
-
"target": "es6",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"module": "commonjs",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"outDir": "./dist",
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"incremental": true,
|
|
12
|
-
"listFiles": false,
|
|
13
|
-
"traceResolution": false,
|
|
14
|
-
"lib": [],
|
|
15
|
-
"types": ["node", "mocha", "should"]
|
|
16
|
-
},
|
|
17
|
-
"include": ["lib/**/*.ts", "lib/*.ts"],
|
|
18
|
-
"exclude": ["node_modules"],
|
|
19
|
-
"files": ["lib/index.ts", "lib/crypto_create_CA.ts"]
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"skipLibCheck": true,
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"incremental": true,
|
|
12
|
+
"listFiles": false,
|
|
13
|
+
"traceResolution": false,
|
|
14
|
+
"lib": [],
|
|
15
|
+
"types": ["node", "mocha", "should"]
|
|
16
|
+
},
|
|
17
|
+
"include": ["lib/**/*.ts", "lib/*.ts"],
|
|
18
|
+
"exclude": ["node_modules"],
|
|
19
|
+
"files": ["lib/index.ts", "lib/crypto_create_CA.ts"]
|
|
20
|
+
}
|
package/dist/misc/fs.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IFs } from "memfs";
|
|
3
|
-
import { EventEmitter } from "node:events";
|
|
4
|
-
export declare const writeFileSync: (id: import("memfs/lib/volume").TFileId, data: import("memfs/lib/volume").TData, options?: import("memfs/lib/volume").IWriteFileOptions | undefined) => void;
|
|
5
|
-
export declare const writeFile: {
|
|
6
|
-
(id: import("memfs/lib/volume").TFileId, data: import("memfs/lib/volume").TData, callback: import("memfs/lib/volume").TCallback<void>): any;
|
|
7
|
-
(id: import("memfs/lib/volume").TFileId, data: import("memfs/lib/volume").TData, options: string | import("memfs/lib/volume").IWriteFileOptions, callback: import("memfs/lib/volume").TCallback<void>): any;
|
|
8
|
-
};
|
|
9
|
-
export declare const existsSync: (path: import("fs").PathLike) => boolean;
|
|
10
|
-
export declare const readFileSync: (file: import("memfs/lib/volume").TFileId, options?: string | import("memfs/lib/volume").IReadFileOptions | undefined) => import("memfs/lib/encoding").TDataOut;
|
|
11
|
-
export declare const unlink: (path: import("fs").PathLike, callback: import("memfs/lib/volume").TCallback<void>) => void;
|
|
12
|
-
export declare const mkdirSync: (path: import("fs").PathLike, options?: import("memfs/lib/volume").TMode | import("memfs/lib/volume").IMkdirOptions | undefined) => void;
|
|
13
|
-
export declare const rename: (oldPath: import("fs").PathLike, newPath: import("fs").PathLike, callback: import("memfs/lib/volume").TCallback<void>) => void;
|
|
14
|
-
export declare const createWriteStream: (path: import("fs").PathLike, options?: string | import("memfs/lib/volume").IWriteStreamOptions | undefined) => import("memfs/lib/volume").IWriteStream;
|
|
15
|
-
export declare type FileSystem = IFs;
|
|
16
|
-
export interface FSWatcher extends EventEmitter {
|
|
17
|
-
/** */
|
|
18
|
-
close(): void;
|
|
19
|
-
}
|
|
20
|
-
export interface Stats {
|
|
21
|
-
/** */
|
|
22
|
-
a: number;
|
|
23
|
-
}
|
|
24
|
-
export declare const promises: import("memfs/lib/promises").IPromisesAPI;
|
package/dist/misc/fs.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import * as _fs from "memfs";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.promises = exports.createWriteStream = exports.rename = exports.mkdirSync = exports.unlink = exports.readFileSync = exports.existsSync = exports.writeFile = exports.writeFileSync = void 0;
|
|
5
|
-
const memfs_1 = require("memfs");
|
|
6
|
-
// export const fs = _fs;
|
|
7
|
-
const json = {
|
|
8
|
-
"/sterfive/NodeOPCUA/node-opcua-pki/tmp": null,
|
|
9
|
-
"/Users/etien/AppData/Local/Temp/": null
|
|
10
|
-
};
|
|
11
|
-
memfs_1.vol.fromJSON(json, "/");
|
|
12
|
-
exports.writeFileSync = memfs_1.fs.writeFileSync;
|
|
13
|
-
exports.writeFile = memfs_1.fs.writeFile;
|
|
14
|
-
exports.existsSync = memfs_1.fs.existsSync;
|
|
15
|
-
exports.readFileSync = memfs_1.fs.readFileSync;
|
|
16
|
-
exports.unlink = memfs_1.fs.unlink;
|
|
17
|
-
exports.mkdirSync = memfs_1.fs.mkdirSync;
|
|
18
|
-
exports.rename = memfs_1.fs.rename;
|
|
19
|
-
exports.createWriteStream = memfs_1.fs.createWriteStream;
|
|
20
|
-
exports.promises = memfs_1.fs.promises;
|
|
21
|
-
//# sourceMappingURL=fs.js.map
|
package/dist/misc/fs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../lib/misc/fs.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;AAEhC,iCAAoC;AAEpC,yBAAyB;AAEzB,MAAM,IAAI,GAAG;IACT,wCAAwC,EAAE,IAAI;IAC9C,kCAAkC,EAAE,IAAI;CAC3C,CAAC;AACF,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAC,GAAG,CAAC,CAAC;AAEV,QAAA,aAAa,GAAG,UAAE,CAAC,aAAa,CAAC;AACjC,QAAA,SAAS,GAAG,UAAE,CAAC,SAAS,CAAC;AACzB,QAAA,UAAU,GAAG,UAAE,CAAC,UAAU,CAAC;AAC3B,QAAA,YAAY,GAAG,UAAE,CAAC,YAAY,CAAC;AAC/B,QAAA,MAAM,GAAE,UAAE,CAAC,MAAM,CAAC;AAClB,QAAA,SAAS,GAAG,UAAE,CAAC,SAAS,CAAC;AACzB,QAAA,MAAM,GAAG,UAAE,CAAC,MAAM,CAAC;AACnB,QAAA,iBAAiB,GAAG,UAAE,CAAC,iBAAiB,CAAC;AAWzC,QAAA,QAAQ,GAAG,UAAE,CAAC,QAAQ,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultFileSystem = void 0;
|
|
4
|
-
const fs = require("./fs");
|
|
5
|
-
function getDefaultFileSystem() {
|
|
6
|
-
return fs;
|
|
7
|
-
}
|
|
8
|
-
exports.getDefaultFileSystem = getDefaultFileSystem;
|
|
9
|
-
//# sourceMappingURL=get_default_filesystem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_default_filesystem.js","sourceRoot":"","sources":["../../lib/misc/get_default_filesystem.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAG3B,SAAgB,oBAAoB;IAChC,OAAO,EAAmB,CAAC;AAC/B,CAAC;AAFD,oDAEC"}
|