node-opcua-pki 6.22.1 → 7.0.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/bin/install_prerequisite.ts +1 -1
- package/bin/pki.ts +1 -1
- package/dist/bin/install_prerequisite.d.ts +2 -0
- package/dist/bin/install_prerequisite.js +6 -0
- package/dist/bin/install_prerequisite.js.map +1 -0
- package/dist/bin/pki.d.ts +2 -0
- package/dist/bin/pki.js +4 -0
- package/dist/bin/pki.js.map +1 -0
- package/dist/lib/ca/backends/native_ca_backend.d.ts +49 -0
- package/dist/lib/ca/backends/native_ca_backend.js +365 -0
- package/dist/lib/ca/backends/native_ca_backend.js.map +1 -0
- package/dist/lib/ca/backends/openssl_ca_backend.d.ts +47 -0
- package/dist/lib/ca/backends/openssl_ca_backend.js +398 -0
- package/dist/lib/ca/backends/openssl_ca_backend.js.map +1 -0
- package/dist/lib/ca/certificate_authority.d.ts +62 -0
- package/dist/lib/ca/certificate_authority.js +91 -0
- package/dist/lib/ca/certificate_authority.js.map +1 -0
- package/dist/lib/ca/core/ca_backend.d.ts +89 -0
- package/dist/lib/ca/core/ca_backend.js +24 -0
- package/dist/lib/ca/core/ca_backend.js.map +1 -0
- package/dist/lib/ca/core/ca_database.d.ts +91 -0
- package/dist/lib/ca/core/ca_database.js +267 -0
- package/dist/lib/ca/core/ca_database.js.map +1 -0
- package/dist/{core-BwqSJPHc.d.mts → lib/ca/core/certificate_authority_core.d.ts} +45 -394
- package/dist/lib/ca/core/certificate_authority_core.js +1300 -0
- package/dist/lib/ca/core/certificate_authority_core.js.map +1 -0
- package/dist/lib/ca/core/index.d.ts +17 -0
- package/dist/lib/ca/core/index.js +25 -0
- package/dist/lib/ca/core/index.js.map +1 -0
- package/dist/lib/ca/crypto_create_CA.d.ts +1 -0
- package/dist/lib/ca/crypto_create_CA.js +821 -0
- package/dist/lib/ca/crypto_create_CA.js.map +1 -0
- package/dist/lib/ca/index.d.ts +1 -0
- package/dist/lib/ca/index.js +2 -0
- package/dist/lib/ca/index.js.map +1 -0
- package/dist/lib/ca/templates/ca_config_template.cnf.d.ts +2 -0
- package/dist/lib/ca/templates/ca_config_template.cnf.js +170 -0
- package/dist/lib/ca/templates/ca_config_template.cnf.js.map +1 -0
- package/dist/lib/core.d.ts +33 -0
- package/dist/lib/core.js +56 -0
- package/dist/lib/core.js.map +1 -0
- package/dist/lib/index.d.ts +11 -0
- package/dist/lib/index.js +37 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/misc/applicationurn.d.ts +1 -0
- package/dist/lib/misc/applicationurn.js +40 -0
- package/dist/lib/misc/applicationurn.js.map +1 -0
- package/dist/lib/misc/hostname.d.ts +8 -0
- package/dist/lib/misc/hostname.js +82 -0
- package/dist/lib/misc/hostname.js.map +1 -0
- package/dist/lib/misc/subject.d.ts +2 -0
- package/dist/lib/misc/subject.js +2 -0
- package/dist/lib/misc/subject.js.map +1 -0
- package/dist/{index.d.ts → lib/pki/certificate_manager.d.ts} +24 -248
- package/dist/lib/pki/certificate_manager.js +2302 -0
- package/dist/lib/pki/certificate_manager.js.map +1 -0
- package/dist/lib/pki/templates/simple_config_template.cnf.d.ts +2 -0
- package/dist/lib/pki/templates/simple_config_template.cnf.js +74 -0
- package/dist/lib/pki/templates/simple_config_template.cnf.js.map +1 -0
- package/dist/lib/pki/toolbox_pfx.d.ts +127 -0
- package/dist/lib/pki/toolbox_pfx.js +248 -0
- package/dist/lib/pki/toolbox_pfx.js.map +1 -0
- package/dist/lib/toolbox/common.d.ts +150 -0
- package/dist/lib/toolbox/common.js +82 -0
- package/dist/lib/toolbox/common.js.map +1 -0
- package/dist/lib/toolbox/common2.d.ts +25 -0
- package/dist/lib/toolbox/common2.js +97 -0
- package/dist/lib/toolbox/common2.js.map +1 -0
- package/dist/lib/toolbox/config.d.ts +5 -0
- package/dist/lib/toolbox/config.js +28 -0
- package/dist/lib/toolbox/config.js.map +1 -0
- package/dist/lib/toolbox/debug.d.ts +5 -0
- package/dist/lib/toolbox/debug.js +35 -0
- package/dist/lib/toolbox/debug.js.map +1 -0
- package/dist/lib/toolbox/display.d.ts +4 -0
- package/dist/lib/toolbox/display.js +56 -0
- package/dist/lib/toolbox/display.js.map +1 -0
- package/dist/lib/toolbox/index.d.ts +5 -0
- package/dist/lib/toolbox/index.js +28 -0
- package/dist/lib/toolbox/index.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/_create_random_file.d.ts +4 -0
- package/dist/lib/toolbox/with_openssl/_create_random_file.js +50 -0
- package/dist/lib/toolbox/with_openssl/_create_random_file.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/_env.d.ts +58 -0
- package/dist/lib/toolbox/with_openssl/_env.js +126 -0
- package/dist/lib/toolbox/with_openssl/_env.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/create_certificate_signing_request.d.ts +5 -0
- package/dist/lib/toolbox/with_openssl/create_certificate_signing_request.js +72 -0
- package/dist/lib/toolbox/with_openssl/create_certificate_signing_request.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/create_private_key.d.ts +5 -0
- package/dist/lib/toolbox/with_openssl/create_private_key.js +92 -0
- package/dist/lib/toolbox/with_openssl/create_private_key.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/create_self_signed_certificate.d.ts +5 -0
- package/dist/lib/toolbox/with_openssl/create_self_signed_certificate.js +135 -0
- package/dist/lib/toolbox/with_openssl/create_self_signed_certificate.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/execute_openssl.d.ts +67 -0
- package/dist/lib/toolbox/with_openssl/execute_openssl.js +246 -0
- package/dist/lib/toolbox/with_openssl/execute_openssl.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/index.d.ts +5 -0
- package/dist/lib/toolbox/with_openssl/index.js +30 -0
- package/dist/lib/toolbox/with_openssl/index.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/install_prerequisite.d.ts +7 -0
- package/dist/lib/toolbox/with_openssl/install_prerequisite.js +358 -0
- package/dist/lib/toolbox/with_openssl/install_prerequisite.js.map +1 -0
- package/dist/lib/toolbox/with_openssl/toolbox.d.ts +53 -0
- package/dist/lib/toolbox/with_openssl/toolbox.js +190 -0
- package/dist/lib/toolbox/with_openssl/toolbox.js.map +1 -0
- package/dist/lib/toolbox/without_openssl/create_certificate_signing_request.d.ts +5 -0
- package/dist/lib/toolbox/without_openssl/create_certificate_signing_request.js +69 -0
- package/dist/lib/toolbox/without_openssl/create_certificate_signing_request.js.map +1 -0
- package/dist/lib/toolbox/without_openssl/create_self_signed_certificate.d.ts +3 -0
- package/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js +78 -0
- package/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js.map +1 -0
- package/dist/lib/toolbox/without_openssl/index.d.ts +2 -0
- package/dist/lib/toolbox/without_openssl/index.js +25 -0
- package/dist/lib/toolbox/without_openssl/index.js.map +1 -0
- package/package.json +11 -30
- package/dist/bin/install_prerequisite.mjs +0 -18
- package/dist/bin/install_prerequisite.mjs.map +0 -1
- package/dist/bin/pki.mjs +0 -5932
- package/dist/bin/pki.mjs.map +0 -1
- package/dist/chunk-EQ4DGI4M.mjs +0 -1917
- package/dist/chunk-EQ4DGI4M.mjs.map +0 -1
- package/dist/chunk-GCHH54PS.mjs +0 -30
- package/dist/chunk-GCHH54PS.mjs.map +0 -1
- package/dist/core-BwqSJPHc.d.ts +0 -1041
- package/dist/core.d.mts +0 -2
- package/dist/core.d.ts +0 -2
- package/dist/core.js +0 -1902
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -21
- package/dist/core.mjs.map +0 -1
- package/dist/index.d.mts +0 -1003
- package/dist/index.js +0 -5009
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -3145
- package/dist/index.mjs.map +0 -1
|
@@ -1,115 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { EventEmitter } from 'node:events';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The default {@link CaBackend}: shells out to the `openssl` CLI, exactly as
|
|
9
|
-
* `CertificateAuthority` always has — this is a pure code move (plus a lock
|
|
10
|
-
* around every database-mutating operation, temp-config cleanup, and
|
|
11
|
-
* explicit `envOverrides` on every config render) with no change in the
|
|
12
|
-
* openssl commands issued or the files produced.
|
|
13
|
-
*/
|
|
14
|
-
declare class OpenSslCaBackend implements CaBackend {
|
|
15
|
-
#private;
|
|
16
|
-
/** The openssl CLI loads its key from a file, so it cannot call out to an HSM. */
|
|
17
|
-
readonly supportsExternalSigner = false;
|
|
18
|
-
preflight(): Promise<void>;
|
|
19
|
-
generateCaCsr(ca: CertificateAuthorityCore, _caRootDir: string, privateKeyFile: string, csrFile: string): Promise<void>;
|
|
20
|
-
bootstrap(ca: CertificateAuthorityCore): Promise<void>;
|
|
21
|
-
regenerateCrl(ca: CertificateAuthorityCore): Promise<void>;
|
|
22
|
-
signSubordinateCsr(ca: CertificateAuthorityCore, csrFile: string, certFile: string, validityDays: number): Promise<void>;
|
|
23
|
-
signEndEntityCsr(ca: CertificateAuthorityCore, certificate: string, csr: string, params1: Params, sanOverride: Required<ProcessAltNamesParam>): Promise<void>;
|
|
24
|
-
revoke(ca: CertificateAuthorityCore, certificate: string, reason: string): Promise<void>;
|
|
25
|
-
createSelfSignedCertificate(ca: CertificateAuthorityCore, certificateFile: string, privateKeyFile: string, params: Params): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** openssl argv entries plus the env they need; merge `env` into `ExecuteOptions.env`. */
|
|
29
|
-
interface OpensslPassArg {
|
|
30
|
-
args: string[];
|
|
31
|
-
env: NodeJS.ProcessEnv;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* return path to the openssl executable
|
|
37
|
-
*/
|
|
38
|
-
declare function install_prerequisite(): Promise<string>;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Options for {@link CertificateAuthority}: the core's, except that the
|
|
42
|
-
* backend is named rather than supplied.
|
|
43
|
-
*/
|
|
44
|
-
interface CertificateAuthorityOptions extends Omit<CertificateAuthorityCoreOptions, "backend"> {
|
|
45
|
-
/**
|
|
46
|
-
* Signing backend to use.
|
|
47
|
-
*
|
|
48
|
-
* - `"openssl"` (default): shells out to the `openssl` CLI, as this
|
|
49
|
-
* class always has.
|
|
50
|
-
* - `"native"`: signs in pure JS via `node-opcua-crypto`, writing the
|
|
51
|
-
* same on-disk database format, and needs no `openssl` executable.
|
|
52
|
-
*
|
|
53
|
-
* Setting `signer` implies `"native"`, since the openssl CLI can only
|
|
54
|
-
* load a key from a file.
|
|
55
|
-
*
|
|
56
|
-
* To supply a backend instance directly - including one of your own -
|
|
57
|
-
* use {@link CertificateAuthorityCore}, which is also the class to
|
|
58
|
-
* build against when you do not want the openssl backend in your
|
|
59
|
-
* bundle at all.
|
|
60
|
-
*/
|
|
61
|
-
backend?: "openssl" | "native";
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* A Certificate Authority with a backend chosen for you.
|
|
65
|
-
*
|
|
66
|
-
* This is {@link CertificateAuthorityCore} plus the convenience that made
|
|
67
|
-
* it the historical API: name a backend, or name nothing and get openssl.
|
|
68
|
-
* Because it resolves the name, it necessarily references both backends,
|
|
69
|
-
* which is why the core exists separately - a program that never imports
|
|
70
|
-
* this class never pulls the openssl backend into its bundle.
|
|
71
|
-
*/
|
|
72
|
-
declare class CertificateAuthority extends CertificateAuthorityCore {
|
|
73
|
-
constructor(options: CertificateAuthorityOptions);
|
|
74
|
-
/**
|
|
75
|
-
* @internal `-passin env:` argv + env for an openssl call that loads
|
|
76
|
-
* this CA's key (always emitted, empty when none).
|
|
77
|
-
*
|
|
78
|
-
* The openssl backend builds its own now; this remains so that external
|
|
79
|
-
* code calling it keeps working, and lives here rather than on the core
|
|
80
|
-
* because the flag means nothing to a backend that spawns nothing.
|
|
81
|
-
*/
|
|
82
|
-
_opensslPassin(): Promise<OpensslPassArg>;
|
|
83
|
-
/**
|
|
84
|
-
* @internal
|
|
85
|
-
* Legacy shim: publish the `CDP_URL` / `AIA_VALUE` config substitution
|
|
86
|
-
* values to the shared env registry, or unset them so the matching
|
|
87
|
-
* `{{#KEY}}...{{/KEY}}` blocks are stripped. Nothing in this package
|
|
88
|
-
* reads the registry any more - every openssl config render receives
|
|
89
|
-
* these values explicitly, from the same {@link caConfigEnvOverrides}
|
|
90
|
-
* builder this delegates to, so the two cannot drift - kept only for
|
|
91
|
-
* external code that renders openssl config templates against the
|
|
92
|
-
* registry directly.
|
|
93
|
-
*
|
|
94
|
-
* It lives on this class rather than the core because it is meaningful
|
|
95
|
-
* only to the openssl backend.
|
|
96
|
-
*/
|
|
97
|
-
_wireRevocationEnvVars(): void;
|
|
98
|
-
}
|
|
99
|
-
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { type Certificate, type CertificateRevocationList, type DER, type IKeyOperations, type PrivateKey } from "node-opcua-crypto";
|
|
3
|
+
import type { SubjectOptions } from "../misc/subject.js";
|
|
4
|
+
import type { CreateSelfSignCertificateParam, Filename, KeySize, PrivateKeyPassphrase, PrivateKeyProvider } from "../toolbox/common.js";
|
|
100
5
|
/**
|
|
101
6
|
* Identifies which PKI sub-store a certificate event originated from.
|
|
102
7
|
*/
|
|
103
|
-
type CertificateStore = "trusted" | "rejected" | "issuersCerts";
|
|
8
|
+
export type CertificateStore = "trusted" | "rejected" | "issuersCerts";
|
|
104
9
|
/**
|
|
105
10
|
* Identifies which PKI sub-store a CRL event originated from.
|
|
106
11
|
*/
|
|
107
|
-
type CrlStore = "crl" | "issuersCrl";
|
|
12
|
+
export type CrlStore = "crl" | "issuersCrl";
|
|
108
13
|
/**
|
|
109
14
|
* Events emitted by {@link CertificateManager} when the
|
|
110
15
|
* file-system watchers detect certificate or CRL changes.
|
|
111
16
|
*/
|
|
112
|
-
interface CertificateManagerEvents {
|
|
17
|
+
export interface CertificateManagerEvents {
|
|
113
18
|
/** A certificate file was added to a store. */
|
|
114
19
|
certificateAdded: (event: {
|
|
115
20
|
store: CertificateStore;
|
|
@@ -148,7 +53,7 @@ interface CertificateManagerEvents {
|
|
|
148
53
|
* By default all checks are **strict** (secure). Set individual
|
|
149
54
|
* flags to `true` only in test/development environments.
|
|
150
55
|
*/
|
|
151
|
-
interface AddCertificateValidationOptions {
|
|
56
|
+
export interface AddCertificateValidationOptions {
|
|
152
57
|
/**
|
|
153
58
|
* Accept certificates whose validity period has expired
|
|
154
59
|
* or is not yet active.
|
|
@@ -179,7 +84,7 @@ interface AddCertificateValidationOptions {
|
|
|
179
84
|
/**
|
|
180
85
|
* Options for creating a {@link CertificateManager}.
|
|
181
86
|
*/
|
|
182
|
-
interface CertificateManagerOptions {
|
|
87
|
+
export interface CertificateManagerOptions {
|
|
183
88
|
/**
|
|
184
89
|
* RSA key size for generated private keys.
|
|
185
90
|
* @defaultValue 2048
|
|
@@ -267,7 +172,7 @@ interface CertificateManagerOptions {
|
|
|
267
172
|
* Parameters for {@link createSelfSignedCertificate}.
|
|
268
173
|
* All fields from {@link CreateSelfSignCertificateParam} are required.
|
|
269
174
|
*/
|
|
270
|
-
interface CreateSelfSignCertificateParam1 extends CreateSelfSignCertificateParam {
|
|
175
|
+
export interface CreateSelfSignCertificateParam1 extends CreateSelfSignCertificateParam {
|
|
271
176
|
/**
|
|
272
177
|
* Output path for the certificate.
|
|
273
178
|
* @defaultValue `"own/certs/self_signed_certificate.pem"`
|
|
@@ -300,7 +205,7 @@ interface CreateSelfSignCertificateParam1 extends CreateSelfSignCertificateParam
|
|
|
300
205
|
* a trusted CA — even if the leaf certificate itself is not
|
|
301
206
|
* in the trusted store.
|
|
302
207
|
*/
|
|
303
|
-
interface VerifyCertificateOptions {
|
|
208
|
+
export interface VerifyCertificateOptions {
|
|
304
209
|
/** Accept certificates whose "Not After" date has passed. */
|
|
305
210
|
acceptOutdatedCertificate?: boolean;
|
|
306
211
|
/** Accept issuer certificates whose "Not After" date has passed. */
|
|
@@ -328,7 +233,7 @@ interface VerifyCertificateOptions {
|
|
|
328
233
|
* These mirror the OPC UA `StatusCode` values for certificate
|
|
329
234
|
* validation results.
|
|
330
235
|
*/
|
|
331
|
-
declare enum VerificationStatus {
|
|
236
|
+
export declare enum VerificationStatus {
|
|
332
237
|
/** The certificate provided as a parameter is not valid. */
|
|
333
238
|
BadCertificateInvalid = "BadCertificateInvalid",
|
|
334
239
|
/** An error occurred verifying security. */
|
|
@@ -362,30 +267,30 @@ declare enum VerificationStatus {
|
|
|
362
267
|
/** Validation OK. */
|
|
363
268
|
Good = "Good"
|
|
364
269
|
}
|
|
365
|
-
declare function coerceCertificateChain(certificate: Certificate | Certificate[]): Certificate[];
|
|
366
|
-
declare function makeFingerprint(certificate: Certificate | Certificate[] | CertificateRevocationList): string;
|
|
367
|
-
declare function toFilenameLabel(commonName: string): string;
|
|
368
|
-
declare function safeStoreJoin(folder: string, filename: string): string;
|
|
270
|
+
export declare function coerceCertificateChain(certificate: Certificate | Certificate[]): Certificate[];
|
|
271
|
+
export declare function makeFingerprint(certificate: Certificate | Certificate[] | CertificateRevocationList): string;
|
|
272
|
+
export declare function toFilenameLabel(commonName: string): string;
|
|
273
|
+
export declare function safeStoreJoin(folder: string, filename: string): string;
|
|
369
274
|
/**
|
|
370
275
|
* Check if the provided certificate acts as an issuer (CA)
|
|
371
276
|
* @param certificate - the DER-encoded certificate
|
|
372
277
|
* @returns true if the certificate has CA basicConstraints or keyCertSign keyUsage
|
|
373
278
|
*/
|
|
374
|
-
declare function isIssuer(certificate: Certificate): boolean;
|
|
279
|
+
export declare function isIssuer(certificate: Certificate): boolean;
|
|
375
280
|
/**
|
|
376
281
|
* Check if the provided certificate acts as an intermediate issuer.
|
|
377
282
|
* An intermediate issuer is a CA certificate that is not a root CA (not self-signed).
|
|
378
283
|
* @param certificate - the DER-encoded certificate
|
|
379
284
|
* @returns true if the certificate is a CA and is not self-signed
|
|
380
285
|
*/
|
|
381
|
-
declare function isIntermediateIssuer(certificate: Certificate): boolean;
|
|
286
|
+
export declare function isIntermediateIssuer(certificate: Certificate): boolean;
|
|
382
287
|
/**
|
|
383
288
|
* Check if the provided certificate acts as a root issuer.
|
|
384
289
|
* A root issuer is a CA certificate that is self-signed.
|
|
385
290
|
* @param certificate - the DER-encoded certificate
|
|
386
291
|
* @returns true if the certificate is a CA and is self-signed
|
|
387
292
|
*/
|
|
388
|
-
declare function isRootIssuer(certificate: Certificate): boolean;
|
|
293
|
+
export declare function isRootIssuer(certificate: Certificate): boolean;
|
|
389
294
|
/**
|
|
390
295
|
* Find the issuer certificate for a given certificate within
|
|
391
296
|
* a provided certificate chain.
|
|
@@ -394,11 +299,11 @@ declare function isRootIssuer(certificate: Certificate): boolean;
|
|
|
394
299
|
* @param chain - candidate issuer certificates to search
|
|
395
300
|
* @returns the matching issuer certificate, or `null` if not found
|
|
396
301
|
*/
|
|
397
|
-
declare function findIssuerCertificateInChain(certificate: Certificate | Certificate[], chain: Certificate[]): Certificate | null;
|
|
302
|
+
export declare function findIssuerCertificateInChain(certificate: Certificate | Certificate[], chain: Certificate[]): Certificate | null;
|
|
398
303
|
/**
|
|
399
304
|
* Lifecycle state of a {@link CertificateManager} instance.
|
|
400
305
|
*/
|
|
401
|
-
declare enum CertificateManagerState {
|
|
306
|
+
export declare enum CertificateManagerState {
|
|
402
307
|
Uninitialized = 0,
|
|
403
308
|
Initializing = 1,
|
|
404
309
|
Initialized = 2,
|
|
@@ -453,7 +358,7 @@ declare enum CertificateManagerState {
|
|
|
453
358
|
/**
|
|
454
359
|
* Status codes returned by {@link CertificateManager.completeCertificateChain}.
|
|
455
360
|
*/
|
|
456
|
-
declare enum ChainCompletionStatus {
|
|
361
|
+
export declare enum ChainCompletionStatus {
|
|
457
362
|
/** The chain already reached a self-signed root — no action was needed. */
|
|
458
363
|
AlreadyComplete = "AlreadyComplete",
|
|
459
364
|
/** One or more issuer certificates were successfully appended. */
|
|
@@ -469,7 +374,7 @@ declare enum ChainCompletionStatus {
|
|
|
469
374
|
/**
|
|
470
375
|
* Result of {@link CertificateManager.completeCertificateChain}.
|
|
471
376
|
*/
|
|
472
|
-
interface ChainCompletionResult {
|
|
377
|
+
export interface ChainCompletionResult {
|
|
473
378
|
/** The (possibly completed) certificate chain, leaf first. */
|
|
474
379
|
chain: Certificate[];
|
|
475
380
|
/** Status code indicating whether completion succeeded and why/why not. */
|
|
@@ -477,7 +382,7 @@ interface ChainCompletionResult {
|
|
|
477
382
|
/** Human-readable diagnostic message. */
|
|
478
383
|
message: string;
|
|
479
384
|
}
|
|
480
|
-
declare class CertificateManager extends EventEmitter {
|
|
385
|
+
export declare class CertificateManager extends EventEmitter {
|
|
481
386
|
#private;
|
|
482
387
|
/**
|
|
483
388
|
* Dispose **all** active CertificateManager instances,
|
|
@@ -872,132 +777,3 @@ declare class CertificateManager extends EventEmitter {
|
|
|
872
777
|
*/
|
|
873
778
|
isCertificateRevoked(certificate: Certificate | Certificate[], issuerCertificate?: Certificate | null): Promise<VerificationStatus>;
|
|
874
779
|
}
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Options for creating a PFX (PKCS#12) file.
|
|
878
|
-
*/
|
|
879
|
-
interface CreatePFXOptions {
|
|
880
|
-
/** Path to the certificate file (PEM or DER). */
|
|
881
|
-
certificateFile: Filename;
|
|
882
|
-
/** Path to the private key file (PEM, plaintext or encrypted PKCS#8). */
|
|
883
|
-
privateKeyFile: Filename;
|
|
884
|
-
/**
|
|
885
|
-
* Passphrase that decrypts `privateKeyFile` if it is an encrypted
|
|
886
|
-
* PKCS#8 key (e.g. a `CertificateManager` created with
|
|
887
|
-
* `privateKeyPassphrase`). Omit for a plaintext key. This is distinct
|
|
888
|
-
* from `passphrase`, which protects the *output* PFX bundle.
|
|
889
|
-
*/
|
|
890
|
-
privateKeyPassphrase?: string;
|
|
891
|
-
/** Output path for the generated PFX file. */
|
|
892
|
-
outputFile: Filename;
|
|
893
|
-
/**
|
|
894
|
-
* Optional passphrase to protect the PFX file.
|
|
895
|
-
* If omitted, the PFX is created without a password.
|
|
896
|
-
*/
|
|
897
|
-
passphrase?: string;
|
|
898
|
-
/**
|
|
899
|
-
* Optional path(s) to CA / intermediate certificate files
|
|
900
|
-
* to include in the PFX bundle.
|
|
901
|
-
*/
|
|
902
|
-
caCertificateFiles?: Filename[];
|
|
903
|
-
/**
|
|
904
|
-
* Optional display label stored on the bundle, the equivalent of
|
|
905
|
-
* openssl's `-name`. The Windows certificate store and `keytool` show
|
|
906
|
-
* it; {@link extractAllFromPFX} and {@link dumpPFX} report it back.
|
|
907
|
-
*/
|
|
908
|
-
friendlyName?: string;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Options for extracting data from a PFX (PKCS#12) file.
|
|
912
|
-
*/
|
|
913
|
-
interface ExtractPFXOptions {
|
|
914
|
-
/** Path to the PFX file. */
|
|
915
|
-
pfxFile: Filename;
|
|
916
|
-
/**
|
|
917
|
-
* Passphrase used when the PFX was created.
|
|
918
|
-
* Pass an empty string for unprotected PFX files.
|
|
919
|
-
*/
|
|
920
|
-
passphrase?: string;
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Result of extracting data from a PFX file.
|
|
924
|
-
*/
|
|
925
|
-
interface ExtractPFXResult {
|
|
926
|
-
/** The certificate in PEM format. */
|
|
927
|
-
certificate: string;
|
|
928
|
-
/** The private key in PEM format. */
|
|
929
|
-
privateKey: string;
|
|
930
|
-
/**
|
|
931
|
-
* The CA / intermediate certificates in PEM format
|
|
932
|
-
* (empty string if none).
|
|
933
|
-
*/
|
|
934
|
-
caCertificates: string;
|
|
935
|
-
/** The display label the bundle carries, if it has one. */
|
|
936
|
-
friendlyName?: string;
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* Create a PFX (PKCS#12) file from a certificate and private key.
|
|
940
|
-
*
|
|
941
|
-
* The bundle is protected with PBES2 / AES-256-CBC under an SHA-256 MAC. If
|
|
942
|
-
* `certificateFile` holds more than one PEM block, the first is the
|
|
943
|
-
* identity and the rest join the issuer chain, ahead of any
|
|
944
|
-
* `caCertificateFiles`.
|
|
945
|
-
*
|
|
946
|
-
* Nothing is written unless every input reads back cleanly and the private
|
|
947
|
-
* key belongs to the certificate, so a wrong `privateKeyPassphrase` or a
|
|
948
|
-
* mismatched pair leaves no half-made file behind.
|
|
949
|
-
*
|
|
950
|
-
* @param options - see {@link CreatePFXOptions}
|
|
951
|
-
*/
|
|
952
|
-
declare function createPFX(options: CreatePFXOptions): Promise<void>;
|
|
953
|
-
/**
|
|
954
|
-
* Extract the client/server certificate from a PFX file.
|
|
955
|
-
*
|
|
956
|
-
* @returns the certificate in PEM format.
|
|
957
|
-
*/
|
|
958
|
-
declare function extractCertificateFromPFX(options: ExtractPFXOptions): Promise<string>;
|
|
959
|
-
/**
|
|
960
|
-
* Extract the private key from a PFX file.
|
|
961
|
-
*
|
|
962
|
-
* @returns the private key as unencrypted PKCS#8 PEM.
|
|
963
|
-
*/
|
|
964
|
-
declare function extractPrivateKeyFromPFX(options: ExtractPFXOptions): Promise<string>;
|
|
965
|
-
/**
|
|
966
|
-
* Extract the CA / intermediate certificates from a PFX file.
|
|
967
|
-
*
|
|
968
|
-
* @returns the CA certificates in PEM format
|
|
969
|
-
* (empty string if none are present).
|
|
970
|
-
*/
|
|
971
|
-
declare function extractCACertificatesFromPFX(options: ExtractPFXOptions): Promise<string>;
|
|
972
|
-
/**
|
|
973
|
-
* Extract certificate + private key + CA certs from a PFX file
|
|
974
|
-
* in a single call.
|
|
975
|
-
*
|
|
976
|
-
* Prefer this over the single-part helpers when you want more than one
|
|
977
|
-
* part: the file is read, decrypted and MAC-verified once here, against
|
|
978
|
-
* once per part.
|
|
979
|
-
*
|
|
980
|
-
* @returns an {@link ExtractPFXResult} with all PEM-encoded parts.
|
|
981
|
-
*/
|
|
982
|
-
declare function extractAllFromPFX(options: ExtractPFXOptions): Promise<ExtractPFXResult>;
|
|
983
|
-
/**
|
|
984
|
-
* Convert a PFX file to a single PEM file holding the private key, the
|
|
985
|
-
* certificate, and any issuer certificates the bundle carries, in that
|
|
986
|
-
* order.
|
|
987
|
-
*/
|
|
988
|
-
declare function convertPFXtoPEM(pfxFile: Filename, pemFile: Filename, passphrase?: string): Promise<void>;
|
|
989
|
-
/**
|
|
990
|
-
* Dump the contents of a PFX file in human-readable form.
|
|
991
|
-
*
|
|
992
|
-
* The layout is this package's own, not `openssl pkcs12 -info`'s: it
|
|
993
|
-
* describes the identity the bundle carries rather than the algorithms it
|
|
994
|
-
* was encrypted with, and it states outright whether the enclosed key
|
|
995
|
-
* matches the enclosed certificate - the question a bundle that will not
|
|
996
|
-
* load is usually being asked. Treat the text as something to read, not to
|
|
997
|
-
* parse; use {@link extractAllFromPFX} to get at the parts.
|
|
998
|
-
*
|
|
999
|
-
* @returns the human-readable dump as a string.
|
|
1000
|
-
*/
|
|
1001
|
-
declare function dumpPFX(pfxFile: Filename, passphrase?: string): Promise<string>;
|
|
1002
|
-
|
|
1003
|
-
export { type AddCertificateValidationOptions, CaBackend, CertificateAuthority, CertificateAuthorityCore, CertificateAuthorityCoreOptions, type CertificateAuthorityOptions, CertificateManager, type CertificateManagerEvents, type CertificateManagerOptions, CertificateManagerState, type CertificateStore, type ChainCompletionResult, ChainCompletionStatus, type CreatePFXOptions, CreateSelfSignCertificateParam, type CreateSelfSignCertificateParam1, type CrlStore, type ExtractPFXOptions, type ExtractPFXResult, Filename, KeySize, OpenSslCaBackend, Params, PrivateKeyPassphrase, PrivateKeyProvider, ProcessAltNamesParam, VerificationStatus, type VerifyCertificateOptions, coerceCertificateChain, convertPFXtoPEM, createPFX, dumpPFX, extractAllFromPFX, extractCACertificatesFromPFX, extractCertificateFromPFX, extractPrivateKeyFromPFX, findIssuerCertificateInChain, install_prerequisite, isIntermediateIssuer, isIssuer, isRootIssuer, makeFingerprint, safeStoreJoin, toFilenameLabel };
|