4.16.0 • Published 1 month ago

node-opcua-pki v4.16.0

Weekly downloads
5,008
License
MIT
Repository
github
Last release
1 month ago

node-opcua-pki

NPM download NPM version Build Status Coverage Status install size FOSSA Status

Installation

install globally
$ npm install -g node-opcua-pki
$ crypto_create_CA --help
use with npx
npx node-opcua-pki --help
npx node-opcua-pki certificate --help

Note: see https://reference.opcfoundation.org/GDS/docs/F.1/

commands

commandHelp
democreate default certificate for node-opcua demos
createCAcreate a Certificate Authority
createPKIcreate a Public Key Infrastructure
certificatecreate a new certificate
csrcreate a new certificate signing request(CSR)
signsign a CSR and generate a certificate
revokerevoke an existing certificate
dumpdisplay a certificate
toderconvert a certificate to a DER format
fingerprintprint the certificate fingerprint

Options: --help display help

create a PKI

node-opcua-pki createPKI

Options:

optiondescriptiontypedefault
-r, --rootthe location of the Certificate folderstringdefault: "{CWD}/certificates"
--PKIFolderthe location of the Public Key Infrastructurestringdefault: "{root}/PKI"
-k, --keySize, --keyLengththe private key size in bits (1024,2048,3072,4096)numberdefault: 2048
-s, --silentminimize outputbooleandefault: false

The result

└─ 📂certificates
    └─📂PKI
       ├─📂issuers
       │ ├─📂certs                 contains known Certificate Authorities' certificates
       │ └─📂crl                   contains Certificate Revocation List associates with the CA Certificates
       ├─📂own
       │ ├─📂certs                 where to store generated public certificates generated for the private key.
       │ └─📂private
       │    └─🔐private_key.pem  the private key in PEM format
       ├─📂rejected                  contains certificates that have been rejected.
       └─📂trusted
         ├─📂certs                 contains the X.509 v3 Certificates that are trusted.
         └─📂crl                   contains the X.509 v3 CRLs for any Certificates in the ./certs directory.

create a Certificate Signing Request (CSR)

Options: | option | description | type | default | |---------------------|-------------------------------------------------|--------|-----------------------------------------------| |-a, --applicationUri |the application URI |string|default: "urn:{hostname}:Node-OPCUA-Server" | |-o, --output | the name of the generated signing_request |string|default: "my_certificate_signing_request.csr"| |--dns | the list of valid domain name (comma separated) |string|default: "{hostname}" | |--ip | the list of valid IPs (comma separated) |string|default: "" | |--subject | the certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello )|string| default: "/CN=Certificate"| |-r, --root | the location of the Certificate folder |string|default: "{CWD}/certificates" | |--PKIFolder | the location of the Public Key Infrastructure |string|default: "{root}/PKI" |

Create a certificate authority

default value
--subjectthe CA certificate subject"/C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=NodeOPCUA-CA"
--root, -rthe location of the Certificate folder"{CWD}/certificates"
--CAFolder, -cthe location of the Certificate Authority folder"{root}/CA"]
--keySize, -k, --keyLengththe private key size in bits (1024, 2048 ,3072, 4096)

The result

└─ 📂certificates
    └─📂PKI
       ├─📂CA           Certificate Authority
       ├─📂rejected     The Certificate store contains certificates that have been rejected.
       │ ├─📂certs      Contains the X.509 v3 Certificates which have been rejected.
       ├─📂trusted      The Certificate store contains trusted Certificates.
       │ ├─📂certs      Contains the X.509 v3 Certificates that are trusted.
       │ └─📂crl        Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.
       ├─📂issuers      The Certificate store contains the CA Certificates needed for validation.
       │ ├─📂certs      Contains the X.509 v3 Certificates that are needed for validation.
       │ ├─📂crl        Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.

sign a signing request (requires a CA)

optiondescriptiontypedefault
-i, --csrthe csrstringdefault: "my_certificate_signing_request.csr"
-o, --outputthe name of the generated certificatestringdefault: "my_certificate.pem"
-v, --validitythe certificate validity in daysnumberdefault: 365
-r, --rootthe location of the Certificate folderstringdefault: "{CWD}/certificates"
-c, --CAFolderthe location of the Certificate Authority folderstringdefault: "{root}/CA"

demo command

this command creates a bunch of certificates with various characteristics for demo and testing purposes.

crypto_create_CA  demo [--dev] [--silent] [--clean]

Options:

--help      display help                                                
--dev      create all sort of fancy certificates for dev testing purposes
--clean    Purge existing directory use with care!                    
--silent, -sminimize output                                              
--root, -rthe location of the Certificate folder{CWD}/certificates

Example:

$crypto_create_CA  demo --dev
certificate command
$crypto_create_CA certificate --help

Options:

--helpdisplay help
--applicationUri, -athe application URIurn:{hostname}:Node-OPCUA-Server
--output, -othe name of the generated certificatemy_certificate.pem
--selfSigned, -sif true, the certificate will be self-signedfalse
--validity, -vthe certificate validity in days
--silent, -sminimize output
--root, -rthe location of the Certificate folder{CWD}/certificates
--CAFolder, -cthe location of the Certificate Authority folder{root}/CA
--PKIFolder, -pthe location of the Public Key Infrastructure{root}/PKI
--privateKey, -poptional:the private key to use to generate certificate
--subjectthe certificate subject ( for instance /C=FR/ST=Centre/L=Orleans/O=SomeOrganization/CN=Hello )
examples
  • create a self-signed certificate
npx node-opcua-pki certificate --dns=machine1.com,machine2.com --ip="192.1.2.3;192.3.4.5" -a 'urn:{hostname}:My-OPCUA-Server' --selfSigned -o  my_self_signed_certificate.pem

References

prerequisite:

This module requires OpenSSL or LibreSSL to be installed.

On Windows, a version of OpenSSL is automatically downloaded and installed at run time, if not present. You will need an internet connection open.

You need to install it on Linux, (or in your docker image), or on macOS

  • on ubuntu/Debian:
apt install openssl

or alpine:

apk add openssl

Support

Sterfive provides this module free of charge, “as is,” with the hope that it will be useful to you. However, any support requests, bug fixes, or enhancements are handled exclusively through our paid services. We believe strongly that independent open-source companies should be fairly compensated for their contributions to the community.

We highly recommend subscribing to our support program to ensure your requests are addressed and resolved. Please note that we only consider requests from members of our support program or sponsors.

Getting professional support

NodeOPCUA PKI is developed and maintained by sterfive.com.

To get professional support, consider subscribing to the node-opcua membership community:

Professional Support

or contact sterfive for dedicated consulting and more advanced support.

:heart: Supporting the development effort - Sponsors & Backers

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, this will help us to maintain a high-quality stack and constant evolution of this module.

If your company would like to participate and influence the development of future versions of node-opcua please contact sterfive.

4.14.0

2 months ago

4.13.0

2 months ago

4.13.1

2 months ago

4.16.0

1 month ago

4.12.0

2 months ago

4.15.0

1 month ago

4.11.0

4 months ago

4.11.1

4 months ago

4.10.0

9 months ago

4.9.0

10 months ago

4.8.1

12 months ago

4.8.0

12 months ago

4.7.0

1 year ago

4.6.0

1 year ago

4.5.0

1 year ago

4.4.0

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.2

1 year ago

4.3.0

1 year ago

4.2.1

1 year ago

4.2.0

1 year ago

4.0.0-beta.8

1 year ago

4.0.0-beta.7

1 year ago

4.0.0-beta.6

1 year ago

4.0.0-beta.5

1 year ago

4.0.0-beta.4

1 year ago

4.0.0-beta.3

1 year ago

4.0.0-beta.2

1 year ago

4.0.0-beta.1

1 year ago

4.1.0

1 year ago

4.1.1

1 year ago

4.0.0-beta.9

1 year ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

2.19.0

2 years ago

2.19.1

2 years ago

2.18.3

2 years ago

2.18.4

2 years ago

2.18.1

2 years ago

2.18.2

2 years ago

2.18.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.17.0

2 years ago

2.16.0

2 years ago

2.15.4

3 years ago

2.15.2

3 years ago

2.15.3

3 years ago

2.15.0

3 years ago

2.15.1

3 years ago

2.14.2

3 years ago

2.14.1

3 years ago

2.14.0

3 years ago

2.13.0

3 years ago

2.12.1

3 years ago

2.12.0

3 years ago

2.11.2

3 years ago

2.11.0

3 years ago

2.11.1

3 years ago

2.10.0

3 years ago

2.9.8

4 years ago

2.9.6

4 years ago

2.9.5

4 years ago

2.9.7

4 years ago

2.9.4

4 years ago

2.9.3

4 years ago

2.9.2

4 years ago

2.9.1

4 years ago

2.9.0

4 years ago

2.8.0

4 years ago

2.7.0

4 years ago

2.6.1

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.2

4 years ago

2.2.0

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.4

4 years ago

2.1.5

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-beta.2

6 years ago

1.0.0-beta.1

6 years ago

0.0.31

6 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago