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.
Files changed (53) hide show
  1. package/.ignore +6 -6
  2. package/.prettierrc +5 -5
  3. package/LICENSE +22 -22
  4. package/bin/crypto_create_CA.js +0 -0
  5. package/bin/crypto_create_CA_config.example.js +18 -18
  6. package/bin/install_prerequisite.js +9 -9
  7. package/dist/crypto_create_CA.d.ts +2 -2
  8. package/dist/crypto_create_CA.js +897 -897
  9. package/dist/index.d.ts +6 -6
  10. package/dist/index.js +44 -44
  11. package/dist/misc/applicationurn.d.ts +1 -1
  12. package/dist/misc/applicationurn.js +46 -46
  13. package/dist/misc/hostname.d.ts +8 -8
  14. package/dist/misc/hostname.js +102 -102
  15. package/dist/misc/install_prerequisite.d.ts +9 -9
  16. package/dist/misc/install_prerequisite.js +363 -360
  17. package/dist/misc/install_prerequisite.js.map +1 -1
  18. package/dist/misc/subject.d.ts +26 -26
  19. package/dist/misc/subject.js +121 -121
  20. package/dist/pki/certificate_authority.d.ts +61 -61
  21. package/dist/pki/certificate_authority.js +481 -481
  22. package/dist/pki/certificate_manager.d.ts +144 -144
  23. package/dist/pki/certificate_manager.js +883 -883
  24. package/dist/pki/certificate_manager.js.map +1 -1
  25. package/dist/pki/common.d.ts +5 -5
  26. package/dist/pki/common.js +2 -2
  27. package/dist/pki/templates/ca_config_template.cnf.d.ts +2 -2
  28. package/dist/pki/templates/ca_config_template.cnf.js +129 -129
  29. package/dist/pki/templates/simple_config_template.cnf.d.ts +2 -2
  30. package/dist/pki/templates/simple_config_template.cnf.js +75 -75
  31. package/dist/pki/toolbox.d.ts +160 -160
  32. package/dist/pki/toolbox.js +699 -699
  33. package/dist/pki/toolbox_pfx.js +18 -18
  34. package/lib/crypto_create_CA.ts +1135 -1135
  35. package/lib/index.ts +28 -28
  36. package/lib/misc/applicationurn.ts +45 -45
  37. package/lib/misc/hostname.ts +89 -89
  38. package/lib/misc/install_prerequisite.ts +454 -454
  39. package/lib/misc/subject.ts +141 -141
  40. package/lib/pki/certificate_manager.ts +1 -1
  41. package/lib/pki/common.ts +5 -5
  42. package/lib/pki/templates/ca_config_template.cnf.ts +129 -129
  43. package/lib/pki/templates/simple_config_template.cnf.ts +75 -75
  44. package/lib/pki/toolbox_pfx.ts +19 -19
  45. package/package.json +89 -89
  46. package/readme.md +214 -214
  47. package/tsconfig.json +20 -20
  48. package/dist/misc/fs.d.ts +0 -24
  49. package/dist/misc/fs.js +0 -21
  50. package/dist/misc/fs.js.map +0 -1
  51. package/dist/misc/get_default_filesystem.d.ts +0 -2
  52. package/dist/misc/get_default_filesystem.js +0 -9
  53. package/dist/misc/get_default_filesystem.js.map +0 -1
@@ -1,160 +1,160 @@
1
- import { SubjectOptions } from "../misc/subject";
2
- import { ErrorCallback, Filename } from "./common";
3
- export declare function quote(str?: string): string;
4
- export declare const g_config: {
5
- opensslVersion: string;
6
- silent: boolean;
7
- force: boolean;
8
- };
9
- export declare function debugLog(...args: [any?, ...any[]]): void;
10
- export declare function find_openssl(callback: (err: Error | null, opensslPath?: string) => void): void;
11
- export declare function mkdir(folder: string): void;
12
- export declare function setEnv(varName: string, value: string): void;
13
- export declare function hasEnv(varName: string): boolean;
14
- export interface ExecuteOptions {
15
- cwd?: string;
16
- hideErrorMessage?: boolean;
17
- }
18
- export declare function execute(cmd: string, options: ExecuteOptions, callback: Callback<string>): void;
19
- export declare function useRandFile(): boolean;
20
- export declare function ensure_openssl_installed(callback: (err?: Error) => void): void;
21
- export interface ExecuteOpenSSLOptions extends ExecuteOptions {
22
- openssl_conf?: string;
23
- }
24
- declare type Callback<T> = (err: Error | null, output?: T) => void;
25
- export declare function execute_openssl(cmd: string, options: ExecuteOpenSSLOptions, callback: Callback<string>): void;
26
- export declare function executeOpensslAsync(cmd: string, options: ExecuteOpenSSLOptions): Promise<string>;
27
- export declare function execute_openssl_no_failure(cmd: string, options: ExecuteOpenSSLOptions, callback: Callback<string>): void;
28
- export declare function displayChapter(str: string, callback?: (err?: Error) => void): void;
29
- export declare function displayTitle(str: string, callback?: (err?: Error) => void): void;
30
- export declare function displaySubtitle(str: string, callback?: (err?: Error) => void): void;
31
- export declare function getEnvironmentVarNames(): any[];
32
- export declare function generateStaticConfig(configPath: string, options?: ExecuteOptions): string;
33
- export declare function make_path(folderName: string, filename?: string): string;
34
- /**
35
- * calculate the public key from private key
36
- * openssl rsa -pubout -in private_key.pem
37
- *
38
- * @method getPublicKeyFromPrivateKey
39
- * @param privateKeyFilename
40
- * @param publicKeyFilename
41
- * @param callback
42
- */
43
- export declare function getPublicKeyFromPrivateKey(privateKeyFilename: string, publicKeyFilename: string, callback: (err: Error | null) => void): void;
44
- /**
45
- * extract public key from a certificate
46
- * openssl x509 -pubkey -in certificate.pem -nottext
47
- *
48
- * @method getPublicKeyFromCertificate
49
- * @param certificateFilename
50
- * @param publicKeyFilename
51
- * @param callback
52
- */
53
- export declare function getPublicKeyFromCertificate(certificateFilename: string, publicKeyFilename: string, callback: (err: Error | null) => void): void;
54
- declare type KeyLength = 1024 | 2048 | 3072 | 4096;
55
- /**
56
- * create a RSA PRIVATE KEY
57
- *
58
- * @method createPrivateKey
59
- *
60
- * @param privateKeyFilename
61
- * @param keyLength
62
- * @param callback {Function}
63
- */
64
- export declare function createPrivateKey(privateKeyFilename: string, keyLength: KeyLength, callback: ErrorCallback): void;
65
- export declare function createRandomFile(randomFile: string, options: ExecuteOptions, callback: (err?: Error) => void): void;
66
- export declare function createRandomFileIfNotExist(randomFile: string, options: ExecuteOptions, callback: ErrorCallback): void;
67
- export interface CreateCertificateSigningRequestOptions extends ProcessAltNamesParam {
68
- subject?: SubjectOptions | string;
69
- }
70
- export interface CreateCertificateSigningRequestWithConfigOptions extends CreateCertificateSigningRequestOptions {
71
- rootDir: Filename;
72
- configFile: Filename;
73
- privateKey: Filename;
74
- }
75
- /**
76
- * create a certificate signing request
77
- *
78
- * @param certificateSigningRequestFilename
79
- * @param params
80
- * @param callback
81
- */
82
- export declare function createCertificateSigningRequest(certificateSigningRequestFilename: string, params: CreateCertificateSigningRequestWithConfigOptions, callback: (err?: Error) => void): void;
83
- export declare function x509Date(date?: Date): string;
84
- export interface ProcessAltNamesParam {
85
- dns?: string[];
86
- ip?: string[];
87
- applicationUri?: string;
88
- }
89
- export interface StartDateEndDateParam {
90
- startDate?: Date;
91
- endDate?: Date;
92
- validity?: number;
93
- }
94
- export interface CreateSelfSignCertificateParam extends ProcessAltNamesParam, StartDateEndDateParam {
95
- subject?: SubjectOptions | string;
96
- }
97
- export declare enum CertificatePurpose {
98
- NotSpecified = 0,
99
- ForCertificateAuthority = 1,
100
- ForApplication = 2,
101
- ForUserAuthentication = 3
102
- }
103
- export interface CreateSelfSignCertificateWithConfigParam extends CreateSelfSignCertificateParam {
104
- rootDir: Filename;
105
- configFile: Filename;
106
- privateKey: Filename;
107
- purpose: CertificatePurpose;
108
- }
109
- export interface Params extends ProcessAltNamesParam, StartDateEndDateParam {
110
- subject?: SubjectOptions | string;
111
- privateKey?: string;
112
- configFile?: string;
113
- rootDir?: string;
114
- outputFile?: string;
115
- reason?: string;
116
- }
117
- export declare function adjustDate(params: StartDateEndDateParam): void;
118
- export declare function adjustApplicationUri(params: Params): void;
119
- export declare function certificateFileExist(certificateFile: string): boolean;
120
- /**
121
- *
122
- * @param params
123
- * @param params.applicationUri
124
- * @param params.dns
125
- * @param params.ip
126
- * @private
127
- */
128
- export declare function processAltNames(params: ProcessAltNamesParam): void;
129
- /**
130
- *
131
- * @param certificate
132
- * @param params
133
- * @param params.configFile
134
- * @param params.rootDir
135
- * @param params.privateKey
136
- * @param params.applicationUri
137
- * @param params.dns
138
- * @param params.ip
139
- * @param params.validity certificate duration in days
140
- * @param params.purpose
141
- * @param [params.subject= "C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=ZZNodeOPCUA"]
142
- * @param callback
143
- */
144
- export declare function createSelfSignCertificate(certificate: string, params: CreateSelfSignCertificateWithConfigParam, callback: (err?: Error | null) => void): void;
145
- export declare const configurationFileTemplate: string;
146
- /**
147
- *
148
- * a minimalist config file for openssl that allows
149
- * self-signed certificate to be generated.
150
- *
151
- */
152
- export declare const configurationFileSimpleTemplate: string;
153
- /**
154
- * @param certificate - the certificate file in PEM format, file must exist
155
- * @param callback
156
- */
157
- export declare function dumpCertificate(certificate: Filename, callback: (err: Error | null, output?: string) => void): void;
158
- export declare function toDer(certificatePem: string, callback: (err: Error | null, output?: string) => void): void;
159
- export declare function fingerprint(certificatePem: string, callback: (err: Error | null, output?: string) => void): void;
160
- export {};
1
+ import { SubjectOptions } from "../misc/subject";
2
+ import { ErrorCallback, Filename } from "./common";
3
+ export declare function quote(str?: string): string;
4
+ export declare const g_config: {
5
+ opensslVersion: string;
6
+ silent: boolean;
7
+ force: boolean;
8
+ };
9
+ export declare function debugLog(...args: [any?, ...any[]]): void;
10
+ export declare function find_openssl(callback: (err: Error | null, opensslPath?: string) => void): void;
11
+ export declare function mkdir(folder: string): void;
12
+ export declare function setEnv(varName: string, value: string): void;
13
+ export declare function hasEnv(varName: string): boolean;
14
+ export interface ExecuteOptions {
15
+ cwd?: string;
16
+ hideErrorMessage?: boolean;
17
+ }
18
+ export declare function execute(cmd: string, options: ExecuteOptions, callback: Callback<string>): void;
19
+ export declare function useRandFile(): boolean;
20
+ export declare function ensure_openssl_installed(callback: (err?: Error) => void): void;
21
+ export interface ExecuteOpenSSLOptions extends ExecuteOptions {
22
+ openssl_conf?: string;
23
+ }
24
+ type Callback<T> = (err: Error | null, output?: T) => void;
25
+ export declare function execute_openssl(cmd: string, options: ExecuteOpenSSLOptions, callback: Callback<string>): void;
26
+ export declare function executeOpensslAsync(cmd: string, options: ExecuteOpenSSLOptions): Promise<string>;
27
+ export declare function execute_openssl_no_failure(cmd: string, options: ExecuteOpenSSLOptions, callback: Callback<string>): void;
28
+ export declare function displayChapter(str: string, callback?: (err?: Error) => void): void;
29
+ export declare function displayTitle(str: string, callback?: (err?: Error) => void): void;
30
+ export declare function displaySubtitle(str: string, callback?: (err?: Error) => void): void;
31
+ export declare function getEnvironmentVarNames(): any[];
32
+ export declare function generateStaticConfig(configPath: string, options?: ExecuteOptions): string;
33
+ export declare function make_path(folderName: string, filename?: string): string;
34
+ /**
35
+ * calculate the public key from private key
36
+ * openssl rsa -pubout -in private_key.pem
37
+ *
38
+ * @method getPublicKeyFromPrivateKey
39
+ * @param privateKeyFilename
40
+ * @param publicKeyFilename
41
+ * @param callback
42
+ */
43
+ export declare function getPublicKeyFromPrivateKey(privateKeyFilename: string, publicKeyFilename: string, callback: (err: Error | null) => void): void;
44
+ /**
45
+ * extract public key from a certificate
46
+ * openssl x509 -pubkey -in certificate.pem -nottext
47
+ *
48
+ * @method getPublicKeyFromCertificate
49
+ * @param certificateFilename
50
+ * @param publicKeyFilename
51
+ * @param callback
52
+ */
53
+ export declare function getPublicKeyFromCertificate(certificateFilename: string, publicKeyFilename: string, callback: (err: Error | null) => void): void;
54
+ type KeyLength = 1024 | 2048 | 3072 | 4096;
55
+ /**
56
+ * create a RSA PRIVATE KEY
57
+ *
58
+ * @method createPrivateKey
59
+ *
60
+ * @param privateKeyFilename
61
+ * @param keyLength
62
+ * @param callback {Function}
63
+ */
64
+ export declare function createPrivateKey(privateKeyFilename: string, keyLength: KeyLength, callback: ErrorCallback): void;
65
+ export declare function createRandomFile(randomFile: string, options: ExecuteOptions, callback: (err?: Error) => void): void;
66
+ export declare function createRandomFileIfNotExist(randomFile: string, options: ExecuteOptions, callback: ErrorCallback): void;
67
+ export interface CreateCertificateSigningRequestOptions extends ProcessAltNamesParam {
68
+ subject?: SubjectOptions | string;
69
+ }
70
+ export interface CreateCertificateSigningRequestWithConfigOptions extends CreateCertificateSigningRequestOptions {
71
+ rootDir: Filename;
72
+ configFile: Filename;
73
+ privateKey: Filename;
74
+ }
75
+ /**
76
+ * create a certificate signing request
77
+ *
78
+ * @param certificateSigningRequestFilename
79
+ * @param params
80
+ * @param callback
81
+ */
82
+ export declare function createCertificateSigningRequest(certificateSigningRequestFilename: string, params: CreateCertificateSigningRequestWithConfigOptions, callback: (err?: Error) => void): void;
83
+ export declare function x509Date(date?: Date): string;
84
+ export interface ProcessAltNamesParam {
85
+ dns?: string[];
86
+ ip?: string[];
87
+ applicationUri?: string;
88
+ }
89
+ export interface StartDateEndDateParam {
90
+ startDate?: Date;
91
+ endDate?: Date;
92
+ validity?: number;
93
+ }
94
+ export interface CreateSelfSignCertificateParam extends ProcessAltNamesParam, StartDateEndDateParam {
95
+ subject?: SubjectOptions | string;
96
+ }
97
+ export declare enum CertificatePurpose {
98
+ NotSpecified = 0,
99
+ ForCertificateAuthority = 1,
100
+ ForApplication = 2,
101
+ ForUserAuthentication = 3
102
+ }
103
+ export interface CreateSelfSignCertificateWithConfigParam extends CreateSelfSignCertificateParam {
104
+ rootDir: Filename;
105
+ configFile: Filename;
106
+ privateKey: Filename;
107
+ purpose: CertificatePurpose;
108
+ }
109
+ export interface Params extends ProcessAltNamesParam, StartDateEndDateParam {
110
+ subject?: SubjectOptions | string;
111
+ privateKey?: string;
112
+ configFile?: string;
113
+ rootDir?: string;
114
+ outputFile?: string;
115
+ reason?: string;
116
+ }
117
+ export declare function adjustDate(params: StartDateEndDateParam): void;
118
+ export declare function adjustApplicationUri(params: Params): void;
119
+ export declare function certificateFileExist(certificateFile: string): boolean;
120
+ /**
121
+ *
122
+ * @param params
123
+ * @param params.applicationUri
124
+ * @param params.dns
125
+ * @param params.ip
126
+ * @private
127
+ */
128
+ export declare function processAltNames(params: ProcessAltNamesParam): void;
129
+ /**
130
+ *
131
+ * @param certificate
132
+ * @param params
133
+ * @param params.configFile
134
+ * @param params.rootDir
135
+ * @param params.privateKey
136
+ * @param params.applicationUri
137
+ * @param params.dns
138
+ * @param params.ip
139
+ * @param params.validity certificate duration in days
140
+ * @param params.purpose
141
+ * @param [params.subject= "C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=ZZNodeOPCUA"]
142
+ * @param callback
143
+ */
144
+ export declare function createSelfSignCertificate(certificate: string, params: CreateSelfSignCertificateWithConfigParam, callback: (err?: Error | null) => void): void;
145
+ export declare const configurationFileTemplate: string;
146
+ /**
147
+ *
148
+ * a minimalist config file for openssl that allows
149
+ * self-signed certificate to be generated.
150
+ *
151
+ */
152
+ export declare const configurationFileSimpleTemplate: string;
153
+ /**
154
+ * @param certificate - the certificate file in PEM format, file must exist
155
+ * @param callback
156
+ */
157
+ export declare function dumpCertificate(certificate: Filename, callback: (err: Error | null, output?: string) => void): void;
158
+ export declare function toDer(certificatePem: string, callback: (err: Error | null, output?: string) => void): void;
159
+ export declare function fingerprint(certificatePem: string, callback: (err: Error | null, output?: string) => void): void;
160
+ export {};