node-opcua-pki 6.19.1 → 6.21.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.
@@ -0,0 +1,1032 @@
1
+ import { SubjectOptions, PrivateKey, CertificatePurpose, Subject, CaSigner } from 'node-opcua-crypto';
2
+
3
+ /** RSA key size in bits. */
4
+ type KeySize = 1024 | 2048 | 3072 | 4096;
5
+ /** Hex-encoded SHA-1 certificate thumbprint. */
6
+ type Thumbprint = string;
7
+ /** A filesystem path to a file. */
8
+ type Filename = string;
9
+ /** Status of a certificate in the trust store. */
10
+ type CertificateStatus = "unknown" | "trusted" | "rejected";
11
+
12
+ /**
13
+ * @deprecated Use {@link KeySize} instead.
14
+ */
15
+ type KeyLength = 1024 | 2048 | 3072 | 4096;
16
+ declare function quote(str?: string): string;
17
+ /**
18
+ * Subject Alternative Name (SAN) parameters for certificate
19
+ * generation.
20
+ */
21
+ interface ProcessAltNamesParam {
22
+ /** DNS host names to include in the SAN extension. */
23
+ dns?: string[];
24
+ /** IP addresses to include in the SAN extension. */
25
+ ip?: string[];
26
+ /** OPC UA application URI for the SAN extension. */
27
+ applicationUri?: string;
28
+ }
29
+ /**
30
+ * Options for creating a Certificate Signing Request (CSR).
31
+ */
32
+ interface CreateCertificateSigningRequestOptions extends ProcessAltNamesParam {
33
+ /** X.500 subject for the certificate. */
34
+ subject?: SubjectOptions | string;
35
+ }
36
+ /**
37
+ * Extended CSR options that include filesystem paths and
38
+ * certificate purpose — used internally by the OpenSSL toolbox.
39
+ */
40
+ interface CreateCertificateSigningRequestWithConfigOptions extends CreateCertificateSigningRequestOptions {
41
+ /** Root directory of the PKI store. */
42
+ rootDir: Filename;
43
+ /** Path to the OpenSSL configuration file. */
44
+ configFile: Filename;
45
+ /**
46
+ * The private key: either a filesystem path to a PEM file (unencrypted;
47
+ * the historical behavior), or an already-resolved in-memory
48
+ * {@link PrivateKey} — see {@link CreateSelfSignCertificateWithConfigParam.privateKey}.
49
+ */
50
+ privateKey: Filename | PrivateKey;
51
+ /** Intended purpose of the certificate. */
52
+ purpose: CertificatePurpose;
53
+ }
54
+ /**
55
+ * Validity period parameters for certificate generation.
56
+ */
57
+ interface StartDateEndDateParam {
58
+ /** Certificate "Not Before" date. Defaults to now. */
59
+ startDate?: Date;
60
+ /** Certificate "Not After" date (computed from validity). */
61
+ endDate?: Date;
62
+ /** Number of days the certificate is valid. @defaultValue 365 */
63
+ validity?: number;
64
+ /**
65
+ * Certificate validity in milliseconds.
66
+ *
67
+ * When provided, takes precedence over {@link validity} and enables
68
+ * sub-day validity (X.509 supports second precision per RFC 5280
69
+ * §4.1.2.5; OpenSSL is invoked with `-startdate`/`-enddate` already).
70
+ *
71
+ * Typical use is short-lived certificates for demos or for renewal
72
+ * cycle testing. Existing day-based callers are unaffected.
73
+ */
74
+ validityMs?: number;
75
+ }
76
+ /**
77
+ * Parameters for creating a self-signed certificate.
78
+ */
79
+ interface CreateSelfSignCertificateParam extends ProcessAltNamesParam, StartDateEndDateParam {
80
+ /** X.500 subject for the certificate. */
81
+ subject?: SubjectOptions | string;
82
+ }
83
+ /**
84
+ * Extended self-signed certificate options that include
85
+ * filesystem paths and purpose — used internally.
86
+ */
87
+ interface CreateSelfSignCertificateWithConfigParam extends CreateSelfSignCertificateParam {
88
+ /** Root directory of the PKI store. */
89
+ rootDir: Filename;
90
+ /** Path to the OpenSSL configuration file. */
91
+ configFile: Filename;
92
+ /**
93
+ * The private key: either a filesystem path to a PEM file (unencrypted;
94
+ * the historical behavior), or an already-resolved in-memory
95
+ * {@link PrivateKey} — used when the key is passphrase-protected on
96
+ * disk, so the decrypted key material is never written back out in
97
+ * cleartext.
98
+ */
99
+ privateKey: Filename | PrivateKey;
100
+ /** Intended purpose of the certificate. */
101
+ purpose: CertificatePurpose;
102
+ }
103
+ /**
104
+ * A passphrase, or a function resolving one — called lazily, and at most
105
+ * once per `CertificateManager` / `CertificateAuthority` instance (the
106
+ * result is cached in memory). Never logged.
107
+ */
108
+ type PrivateKeyPassphrase = string | (() => Promise<string>);
109
+ /**
110
+ * Sources a {@link PrivateKey} from somewhere other than the local
111
+ * filesystem (an HSM, a KMS, ...). When configured on `CertificateManager`,
112
+ * it overrides disk entirely — the on-disk `own/private/private_key.pem` is
113
+ * neither generated nor read. `CertificateAuthority` does not support a
114
+ * provider (its signing paths are openssl reading a key file); it does
115
+ * support `privateKeyPassphrase`.
116
+ */
117
+ interface PrivateKeyProvider {
118
+ getPrivateKey(): Promise<PrivateKey>;
119
+ }
120
+ /** Resolve a {@link PrivateKeyPassphrase}, if configured. */
121
+ declare function resolvePrivateKeyPassphrase(passphrase: PrivateKeyPassphrase | undefined): Promise<string | undefined>;
122
+ /**
123
+ * General-purpose parameters passed to CA operations such as
124
+ * {@link CertificateAuthority.signCertificateRequest} and
125
+ * {@link CertificateAuthority.revokeCertificate}.
126
+ */
127
+ interface Params extends ProcessAltNamesParam, StartDateEndDateParam {
128
+ /** X.500 subject for the certificate. */
129
+ subject?: SubjectOptions | string;
130
+ /** Path to the private key file. */
131
+ privateKey?: string;
132
+ /** Path to the OpenSSL configuration file. */
133
+ configFile?: string;
134
+ /** Root directory of the PKI store. */
135
+ rootDir?: string;
136
+ /** Output filename for the generated certificate. */
137
+ outputFile?: string;
138
+ /** CRL revocation reason (e.g. `"keyCompromise"`). */
139
+ reason?: string;
140
+ }
141
+ declare function adjustDate(params: StartDateEndDateParam): void;
142
+ declare function adjustApplicationUri(params: Params): void;
143
+
144
+ /**
145
+ * A record from the OpenSSL CA certificate database (`index.txt`).
146
+ */
147
+ interface IssuedCertificateRecord {
148
+ /** Hex-encoded serial number (e.g. `"1000"`). */
149
+ serial: string;
150
+ /** Certificate status. */
151
+ status: "valid" | "revoked" | "expired";
152
+ /** X.500 subject string (slash-delimited). */
153
+ subject: string;
154
+ /** Certificate expiry date as ISO-8601 string. */
155
+ expiryDate: string;
156
+ /**
157
+ * Revocation date as ISO-8601 string.
158
+ * Only present when `status === "revoked"`.
159
+ */
160
+ revocationDate?: string;
161
+ /**
162
+ * CRL revocation reason (e.g. `"keyCompromise"`), as stored after the
163
+ * comma in the revocation-date field. Only present when
164
+ * `status === "revoked"` and a reason was recorded.
165
+ */
166
+ reason?: string;
167
+ }
168
+ /**
169
+ * Read and write access to a CA's OpenSSL-format certificate database
170
+ * (`index.txt`, `serial`, `crlnumber`, `certs/<SERIAL>.pem`).
171
+ *
172
+ * This is the format `openssl ca` itself writes and reads; every mutating
173
+ * method here (`nextSerial`, `nextCrlNumber`, `appendIssued`, `markRevoked`,
174
+ * `storeCertificate`) exists so a native (non-openssl) signing backend can
175
+ * write the exact same on-disk format `openssl ca` does, so an install can
176
+ * move between backends and external `openssl` tooling keeps working on the
177
+ * same directory. Callers are responsible for serializing access — every
178
+ * mutating call must happen under the owning CA's directory lock
179
+ * (`CertificateAuthority._withCaDirectoryLock`), the same guarantee
180
+ * `OpenSslCaBackend` gets from the lock around each `openssl ca` /
181
+ * `openssl x509 -CAserial` invocation.
182
+ */
183
+ declare class CaDatabase {
184
+ #private;
185
+ constructor(rootDir: string);
186
+ /** Path to the OpenSSL certificate database file (`index.txt`). */
187
+ get indexFile(): string;
188
+ /**
189
+ * Parse the OpenSSL `index.txt` certificate database.
190
+ *
191
+ * Each line has tab-separated fields:
192
+ * ```
193
+ * status expiry [revocationDate] serial unknown subject
194
+ * ```
195
+ *
196
+ * - status: `V` (valid), `R` (revoked), `E` (expired)
197
+ * - expiry: `YYMMDDHHmmssZ`
198
+ * - revocationDate: present only for revoked certs
199
+ * - serial: hex string
200
+ * - unknown: always `"unknown"`
201
+ * - subject: X.500 slash-delimited string
202
+ */
203
+ readIndex(): IssuedCertificateRecord[];
204
+ /** Look up one record by serial number (case-insensitive). */
205
+ findBySerial(serial: string): IssuedCertificateRecord | undefined;
206
+ /**
207
+ * Read a specific issued certificate by serial number.
208
+ *
209
+ * OpenSSL stores signed certificates in the `certs/` directory using
210
+ * the naming convention `<SERIAL>.pem`.
211
+ *
212
+ * @param serial - hex-encoded serial number (e.g. `"1000"`)
213
+ * @returns the DER buffer, or `undefined` if not found
214
+ */
215
+ getCertificateBySerial(serial: string): Buffer | undefined;
216
+ /** Hand out the next certificate serial number, bumping the `serial` file. */
217
+ nextSerial(): string;
218
+ /** Hand out the next CRL number, bumping the `crlnumber` file. */
219
+ nextCrlNumber(): string;
220
+ /** Append a newly-issued certificate's `V` (valid) row to `index.txt`. */
221
+ appendIssued(record: {
222
+ serial: string;
223
+ expiryDate: Date;
224
+ subject: string;
225
+ }): void;
226
+ /**
227
+ * Rewrite a certificate's `index.txt` row from `V` to `R` (revoked).
228
+ * Throws if the serial is not found, or is already revoked — the same
229
+ * "already revoked" case `openssl ca -revoke` itself rejects.
230
+ */
231
+ markRevoked(serial: string, revocationDate: Date, reason: string): void;
232
+ /** Store a signed certificate's PEM under `certs/<SERIAL>.pem`, as `openssl ca` does. */
233
+ storeCertificate(serial: string, pem: string): void;
234
+ }
235
+
236
+ /** Default X.500 subject used when no custom subject is provided. */
237
+ declare const defaultSubject = "/C=FR/ST=IDF/L=Paris/O=Local NODE-OPCUA Certificate Authority/CN=NodeOPCUA-CA";
238
+ declare const configurationFileTemplate: string;
239
+ /**
240
+ * Escape a value for use inside a double-quoted openssl config value.
241
+ *
242
+ * openssl's config parser (crypto/conf/conf_def.c) treats an unquoted value
243
+ * specially: `$var` / `${var}` / `$(var)` are expanded, and `'`, `"` and the
244
+ * backtick are all quote characters (a backtick pair is silently removed).
245
+ * Inside a double-quoted value none of that applies: characters are copied
246
+ * verbatim except a backslash, which escapes the next character. So a path
247
+ * containing `$`, backticks, `#` or spaces is safe once double-quoted with
248
+ * `\` and `"` escaped.
249
+ */
250
+ declare function escapeOpensslConfDoubleQuoted(value: string): string;
251
+ /**
252
+ * Render the CA openssl configuration for `caRootDir`. The root folder is
253
+ * emitted forward-slashed (openssl accepts that on every platform) and
254
+ * double-quoted, so a CA `location` containing characters that openssl's
255
+ * config syntax would otherwise interpret (`$`, backticks, `#`, quotes) is
256
+ * taken literally.
257
+ */
258
+ declare function renderCaConfig(caRootDir: string): string;
259
+ /**
260
+ * Result of {@link CertificateAuthority.initializeCSR}.
261
+ *
262
+ * - `"ready"` — the CA certificate already exists and is valid.
263
+ * - `"pending"` — key + CSR exist but no cert; waiting for external signing.
264
+ * - `"created"` — a fresh key + CSR were just generated.
265
+ * - `"expired"` — the CA certificate has expired (or will expire within
266
+ * the configured threshold). A new CSR has been generated for renewal
267
+ * while preserving the existing private key.
268
+ */
269
+ type InitializeCSRResult = {
270
+ status: "ready";
271
+ } | {
272
+ status: "pending";
273
+ csrPath: string;
274
+ } | {
275
+ status: "created";
276
+ csrPath: string;
277
+ } | {
278
+ status: "expired";
279
+ csrPath: string;
280
+ expiryDate: Date;
281
+ };
282
+ /**
283
+ * Result of {@link CertificateAuthority.installCACertificate}.
284
+ *
285
+ * - `"success"` — the certificate was installed and CRL generated.
286
+ * - `"error"` — the certificate was rejected (see `reason`).
287
+ */
288
+ type InstallCACertificateResult = {
289
+ status: "success";
290
+ } | {
291
+ status: "error";
292
+ reason: string;
293
+ message: string;
294
+ };
295
+ /**
296
+ * Options for creating a {@link CertificateAuthority}.
297
+ */
298
+ interface CertificateAuthorityCoreOptions {
299
+ /** RSA key size for the CA private key. */
300
+ keySize: KeySize;
301
+ /** Filesystem path where the CA directory structure is stored. */
302
+ location: string;
303
+ /**
304
+ * X.500 subject for the CA certificate.
305
+ * Accepts a slash-delimited string (e.g. `"/CN=My CA/O=Acme"`) or
306
+ * a structured {@link SubjectOptions} object.
307
+ *
308
+ * @defaultValue {@link defaultSubject}
309
+ */
310
+ subject?: string | SubjectOptions;
311
+ /**
312
+ * Parent CA that will sign this CA's certificate.
313
+ * If omitted, the CA is self-signed (root CA).
314
+ * The parent CA must be initialized before this CA.
315
+ */
316
+ issuerCA?: CertificateAuthorityCore;
317
+ /**
318
+ * Public URL (http/https) where the CRL produced by this CA is
319
+ * reachable. When set, every issued certificate carries an
320
+ * X.509v3 `crlDistributionPoints` extension pointing at this URL.
321
+ *
322
+ * Leave undefined to omit the extension entirely (opt-in — see
323
+ * US-202). Validated synchronously at construction / setter call.
324
+ */
325
+ crlDistributionUrl?: string;
326
+ /**
327
+ * Public URL of the OCSP responder. When set, every issued cert
328
+ * carries an `authorityInfoAccess` extension with an `OCSP` leg
329
+ * pointing at this URL. Leave undefined to omit (US-202).
330
+ */
331
+ ocspResponderUrl?: string;
332
+ /**
333
+ * Public URL where the issuer's certificate can be fetched.
334
+ * When set, the `authorityInfoAccess` extension on every issued
335
+ * cert carries a `caIssuers` leg pointing at this URL (chain
336
+ * repair). Leave undefined to omit (US-202).
337
+ */
338
+ caIssuersUrl?: string;
339
+ /**
340
+ * Encrypt the CA private key (`private/cakey.pem`) at rest with this
341
+ * passphrase (opt-in, default off). When set:
342
+ * - a freshly generated CA key is written as encrypted PKCS#8;
343
+ * - an existing *plaintext* CA key is encrypted in place by
344
+ * {@link CertificateAuthority.initialize} / `initializeCSR()`;
345
+ * - every `openssl` invocation that loads the CA key (CSR, self-sign,
346
+ * sign, revoke, CRL generation) receives it via `-passin env:`, never
347
+ * in argv; a missing or wrong passphrase fails `initialize()` closed.
348
+ *
349
+ * A function is called at most once per instance; the resolved
350
+ * passphrase is kept in memory for the instance's lifetime because the
351
+ * CA hands it to each openssl child. Never logged.
352
+ *
353
+ * A subordinate CA (`issuerCA` set) uses the *issuer's* passphrase for
354
+ * the issuer's key: construct the parent with its own option.
355
+ */
356
+ privateKeyPassphrase?: PrivateKeyPassphrase;
357
+ /**
358
+ * Who actually signs, and writes the certificate database. Supplying it
359
+ * is the whole point of this class: nothing here names a concrete
360
+ * backend, so a program that only ever uses the native one never
361
+ * references - and never has to ship - the openssl one.
362
+ *
363
+ * {@link CertificateAuthority} is the batteries-included subclass that
364
+ * picks a backend for you from a `"openssl" | "native"` option.
365
+ */
366
+ backend: CaBackend;
367
+ /**
368
+ * Sign with an external key that never leaves its holder - an HSM or a
369
+ * cloud KMS - instead of `private/cakey.pem`. The signer exposes only
370
+ * `getPublicKey()` and `sign(tbs)`; this class builds the to-be-signed
371
+ * bytes locally and asks the signer for the signature.
372
+ *
373
+ * Setting this implies `backend: "native"` (the openssl CLI can only
374
+ * load a key from a file, so it cannot honour a signer); combining it
375
+ * with an explicit `backend: "openssl"` is a constructor error. No
376
+ * `private/cakey.pem` is generated, and the key-file operations that
377
+ * cannot apply - {@link CertificateAuthority.getPrivateKey} and
378
+ * {@link CertificateAuthority.reencryptPrivateKey} - throw.
379
+ */
380
+ signer?: CaSigner;
381
+ }
382
+
383
+ /**
384
+ * Options for {@link CertificateAuthority.signCertificateRequestFromDER}.
385
+ *
386
+ * All fields are optional. When provided, they override the
387
+ * corresponding values from the CSR.
388
+ */
389
+ interface SignCertificateOptions {
390
+ /** Certificate validity in days (default: 365). */
391
+ validity?: number;
392
+ /**
393
+ * Certificate validity in milliseconds.
394
+ *
395
+ * When provided, takes precedence over {@link validity} and enables
396
+ * sub-day validity (e.g. 10-minute certificates for renewal demos).
397
+ */
398
+ validityMs?: number;
399
+ /** Override the certificate start date. */
400
+ startDate?: Date;
401
+ /** Override DNS SANs. */
402
+ dns?: string[];
403
+ /** Override IP SANs. */
404
+ ip?: string[];
405
+ /** Override the application URI SAN. */
406
+ applicationUri?: string;
407
+ /** Override the X.500 subject. */
408
+ subject?: SubjectOptions | string;
409
+ }
410
+ /**
411
+ * Capabilities advertised by a PKI backend (or by this
412
+ * {@link CertificateAuthority}) so consumers can clamp requested
413
+ * validity to the limits the backend can actually honor.
414
+ *
415
+ * Useful for the GDS Pull / Push management flows, where the CA may
416
+ * be supplied by an external service (step-ca, EJBCA, …) with its
417
+ * own minimum / maximum / granularity constraints.
418
+ *
419
+ * @see CertificateAuthority.getCapabilities
420
+ */
421
+ interface PkiBackendCapabilities {
422
+ /** Smallest validity this backend can issue, in milliseconds. */
423
+ minValidityMs: number;
424
+ /** Largest validity this backend will issue, in milliseconds. */
425
+ maxValidityMs: number;
426
+ /**
427
+ * Validity is rounded up to the nearest multiple of this many
428
+ * milliseconds. For `node-opcua-pki`'s OpenSSL-based CA this is
429
+ * 1 000 ms (one second — the X.509 floor per RFC 5280 §4.1.2.5).
430
+ */
431
+ validityGranularityMs: number;
432
+ /**
433
+ * Native unit the backend works in. Diagnostic only — callers
434
+ * always pass `validityMs` (US-208 / US-210).
435
+ */
436
+ nativeUnit: "second" | "minute" | "hour" | "day";
437
+ }
438
+ /**
439
+ * Options for {@link CertificateAuthority.generateKeyPairAndSignDER}.
440
+ */
441
+ interface GenerateKeyPairAndSignOptions {
442
+ /** OPC UA application URI (required). */
443
+ applicationUri: string;
444
+ /** X.500 subject for the certificate (e.g. "CN=MyApp"). */
445
+ subject?: SubjectOptions | string;
446
+ /** DNS host names for the SAN extension. */
447
+ dns?: string[];
448
+ /** IP addresses for the SAN extension. */
449
+ ip?: string[];
450
+ /** Certificate validity in days (default: 365). */
451
+ validity?: number;
452
+ /**
453
+ * Certificate validity in milliseconds.
454
+ *
455
+ * When provided, takes precedence over {@link validity} and enables
456
+ * sub-day validity (e.g. 10-minute certificates for renewal demos).
457
+ */
458
+ validityMs?: number;
459
+ /** Certificate start date (default: now). */
460
+ startDate?: Date;
461
+ /** RSA key size in bits (default: 2048). */
462
+ keySize?: KeySize;
463
+ }
464
+ /**
465
+ * Options for {@link CertificateAuthority.generateKeyPairAndSignPFX}.
466
+ *
467
+ * Extends the DER options with an optional `passphrase` to protect
468
+ * the PFX bundle.
469
+ */
470
+ interface GenerateKeyPairAndSignPFXOptions extends GenerateKeyPairAndSignOptions {
471
+ /**
472
+ * Passphrase to protect the PFX file.
473
+ * If omitted, the PFX is created without a password.
474
+ */
475
+ passphrase?: string;
476
+ }
477
+ declare class CertificateAuthorityCore {
478
+ #private;
479
+ /** RSA key size used when generating the CA private key. */
480
+ readonly keySize: KeySize;
481
+ /** Root filesystem path of the CA directory structure. */
482
+ readonly location: string;
483
+ /** X.500 subject of the CA certificate. */
484
+ readonly subject: Subject;
485
+ /** @internal Parent CA (undefined for root CAs). */
486
+ readonly _issuerCA?: CertificateAuthorityCore;
487
+ /** @internal Configured CDP / AIA URLs (US-202). */
488
+ private _crlDistributionUrl?;
489
+ private _ocspResponderUrl?;
490
+ private _caIssuersUrl?;
491
+ constructor(options: CertificateAuthorityCoreOptions);
492
+ /**
493
+ * Public URL where the CRL produced by this CA is reachable, or
494
+ * `undefined` if no CDP extension should be emitted on issued certs.
495
+ */
496
+ get crlDistributionUrl(): string | undefined;
497
+ /**
498
+ * Public URL of the OCSP responder, or `undefined` if no AIA OCSP
499
+ * leg should be emitted on issued certs.
500
+ */
501
+ get ocspResponderUrl(): string | undefined;
502
+ /**
503
+ * Public URL where the issuer's certificate can be fetched, or
504
+ * `undefined` if no AIA caIssuers leg should be emitted.
505
+ */
506
+ get caIssuersUrl(): string | undefined;
507
+ /**
508
+ * Configure the URL embedded as `crlDistributionPoints` in every
509
+ * subsequently-issued certificate. Pass `undefined` to disable
510
+ * the extension entirely. Validated synchronously — throws on
511
+ * empty string, non-http(s) protocol, missing path. Warns (does
512
+ * not throw) when the URL points at loopback.
513
+ *
514
+ * @see US-202
515
+ */
516
+ setCrlDistributionUrl(url: string | undefined): void;
517
+ /**
518
+ * Configure the OCSP responder URL embedded as the `OCSP` leg of
519
+ * the `authorityInfoAccess` extension on every subsequently-issued
520
+ * certificate. Pass `undefined` to disable.
521
+ *
522
+ * @see US-202
523
+ */
524
+ setOcspResponderUrl(url: string | undefined): void;
525
+ /**
526
+ * Configure the caIssuers URL embedded as the `caIssuers` leg of
527
+ * the `authorityInfoAccess` extension on every subsequently-issued
528
+ * certificate. Pass `undefined` to disable.
529
+ *
530
+ * @see US-202
531
+ */
532
+ setCaIssuersUrl(url: string | undefined): void;
533
+ /** Absolute path to the CA root directory (alias for {@link location}). */
534
+ get rootDir(): string;
535
+ /** Path to the OpenSSL configuration file (`conf/caconfig.cnf`). */
536
+ get configFile(): string;
537
+ /** Path to the CA private key (`private/cakey.pem`); may be passphrase-encrypted, see {@link getPrivateKey}. */
538
+ get privateKey(): string;
539
+ /**
540
+ * The CA private key, decrypted with the configured `privateKeyPassphrase`
541
+ * if it is encrypted. Fails closed (`PrivateKeyPassphraseRequiredError`)
542
+ * on an encrypted key with no or the wrong passphrase.
543
+ */
544
+ getPrivateKey(): Promise<PrivateKey>;
545
+ /**
546
+ * True when this CA signs with an external {@link CaSigner} (HSM/KMS)
547
+ * rather than with `private/cakey.pem`. There is then no private key
548
+ * file on disk, and never was one.
549
+ */
550
+ get hasExternalSigner(): boolean;
551
+ /**
552
+ * @internal The key every signing operation goes through. An injected
553
+ * {@link CaSigner} is returned as-is; otherwise the on-disk key is read
554
+ * (and decrypted) and handed over as a plain `CryptoKey`. Both are
555
+ * accepted by the `node-opcua-crypto` signing primitives, so callers
556
+ * never branch on which one they got.
557
+ */
558
+ _getSigningKey(): Promise<CryptoKey | CaSigner>;
559
+ /**
560
+ * Enable, disable, or rotate the passphrase protecting `private/cakey.pem`
561
+ * (temp file + atomic rename, temp file removed on failure). Only
562
+ * rewrites the file: construct a new `CertificateAuthority` with the new
563
+ * passphrase to continue using it.
564
+ */
565
+ reencryptPrivateKey(oldPassphrase?: PrivateKeyPassphrase, newPassphrase?: PrivateKeyPassphrase): Promise<void>;
566
+ /** @internal resolve the configured passphrase, at most once per instance */
567
+ _privateKeyPassphrase(): Promise<string | undefined>;
568
+ /**
569
+ * @internal On an existing key: encrypt it in place if a passphrase is
570
+ * configured and it is still plaintext (secure by default: the option
571
+ * means "protect this key", not "ignore me"), then read it back so a
572
+ * wrong or missing passphrase fails initialize() closed rather than the
573
+ * first signing operation.
574
+ */
575
+ _ensurePrivateKeyProtection(): Promise<void>;
576
+ /**
577
+ * @internal Run `action` under this CA's directory lock. For the one
578
+ * legitimate cross-instance use: a subordinate CA's bootstrap signs its
579
+ * certificate with `openssl x509 -CAserial`, which read-increment-writes
580
+ * THIS issuer's `serial` file, and must therefore hold this issuer's
581
+ * lock (ordering is always subordinate -> issuer, so no cycle).
582
+ */
583
+ _withCaDirectoryLock<T>(action: () => Promise<T>): Promise<T>;
584
+ /** Path to the CA certificate in PEM format (`public/cacert.pem`). */
585
+ get caCertificate(): string;
586
+ /**
587
+ * Path to the issuer certificate chain (`public/issuer_chain.pem`).
588
+ *
589
+ * This file is created by {@link installCACertificate} when the
590
+ * provided cert file contains additional issuer certificates
591
+ * (e.g. intermediate + root). It is appended to signed certs
592
+ * by {@link constructCertificateChain} to produce a full chain
593
+ * per OPC UA Part 6 §6.2.6.
594
+ */
595
+ get issuerCertificateChain(): string;
596
+ /**
597
+ * Path to the current Certificate Revocation List in DER format.
598
+ * (`crl/revocation_list.der`)
599
+ */
600
+ get revocationListDER(): string;
601
+ /**
602
+ * Path to the current Certificate Revocation List in PEM format.
603
+ * (`crl/revocation_list.crl`)
604
+ */
605
+ get revocationList(): string;
606
+ /**
607
+ * Path to the concatenated CA certificate + CRL file.
608
+ * Used by OpenSSL for CRL-based verification.
609
+ */
610
+ get caCertificateWithCrl(): string;
611
+ /**
612
+ * Return the CA certificate as a DER-encoded buffer.
613
+ *
614
+ * @throws if the CA certificate file does not exist
615
+ * (call {@link initialize} first).
616
+ */
617
+ getCACertificateDER(): Buffer;
618
+ /**
619
+ * Return the CA certificate as a PEM-encoded string.
620
+ *
621
+ * @throws if the CA certificate file does not exist
622
+ * (call {@link initialize} first).
623
+ */
624
+ getCACertificatePEM(): string;
625
+ /**
626
+ * Return the current Certificate Revocation List as a
627
+ * DER-encoded buffer.
628
+ *
629
+ * Returns an empty buffer if no CRL has been generated yet.
630
+ */
631
+ getCRLDER(): Buffer;
632
+ /**
633
+ * Return the current Certificate Revocation List as a
634
+ * PEM-encoded string.
635
+ *
636
+ * Returns an empty string if no CRL has been generated yet.
637
+ */
638
+ getCRLPEM(): string;
639
+ /**
640
+ * Return a list of all issued certificates recorded in the
641
+ * OpenSSL `index.txt` database.
642
+ *
643
+ * Each entry includes the serial number, subject, status,
644
+ * expiry date, and (for revoked certs) the revocation date.
645
+ */
646
+ getIssuedCertificates(): IssuedCertificateRecord[];
647
+ /**
648
+ * Return the total number of certificates recorded in
649
+ * `index.txt`.
650
+ */
651
+ getIssuedCertificateCount(): number;
652
+ /**
653
+ * Return the status of a certificate by its serial number.
654
+ *
655
+ * @param serial - hex-encoded serial number (e.g. `"1000"`)
656
+ * @returns `"valid"`, `"revoked"`, `"expired"`, or
657
+ * `undefined` if not found
658
+ */
659
+ getCertificateStatus(serial: string): "valid" | "revoked" | "expired" | undefined;
660
+ /**
661
+ * Read a specific issued certificate by serial number and
662
+ * return its content as a DER-encoded buffer.
663
+ *
664
+ * OpenSSL stores signed certificates in the `certs/`
665
+ * directory using the naming convention `<SERIAL>.pem`.
666
+ *
667
+ * @param serial - hex-encoded serial number (e.g. `"1000"`)
668
+ * @returns the DER buffer, or `undefined` if not found
669
+ */
670
+ getCertificateBySerial(serial: string): Buffer | undefined;
671
+ /**
672
+ * Path to the OpenSSL certificate database file.
673
+ */
674
+ get indexFile(): string;
675
+ /**
676
+ * Sign a DER-encoded Certificate Signing Request and return
677
+ * the signed certificate as a DER buffer.
678
+ *
679
+ * This method handles temp-file creation and cleanup
680
+ * internally so that callers can work with in-memory
681
+ * buffers only.
682
+ *
683
+ * The CA can override fields from the CSR by passing
684
+ * `options.dns`, `options.ip`, `options.applicationUri`,
685
+ * `options.startDate`, or `options.subject`.
686
+ *
687
+ * @param csrDer - the CSR as a DER-encoded buffer
688
+ * @param options - signing options and CA overrides
689
+ * @returns the signed certificate as a DER-encoded buffer
690
+ */
691
+ signCertificateRequestFromDER(csrDer: Buffer, options?: SignCertificateOptions): Promise<Buffer>;
692
+ /**
693
+ * Advertise the validity limits this CA can honor.
694
+ *
695
+ * Consumers (notably the GDS server in [`cert_auth.ts`](https://github.com/sterfive/node-opcua-gds))
696
+ * clamp a requested validity against these bounds before calling
697
+ * {@link signCertificateRequestFromDER}, so a misconfigured
698
+ * `defaultCertValidity` cannot ask the CA for something it cannot
699
+ * produce.
700
+ *
701
+ * Defaults match the OpenSSL-backed implementation:
702
+ * - `minValidityMs = 60_000` (1 minute) — practical floor; the
703
+ * X.509 spec floor is 1 second but very short certs are rarely
704
+ * useful and pathological for any real deployment.
705
+ * - `maxValidityMs = 10 * 365 * 86_400_000` (≈ 10 years) — long
706
+ * enough for root CAs.
707
+ * - `validityGranularityMs = 1_000` (1 second) — RFC 5280 §4.1.2.5
708
+ * floor on `notBefore` / `notAfter`.
709
+ * - `nativeUnit = "second"` — what `x509Date()` actually encodes.
710
+ *
711
+ * @see US-208 — the consumer-side capability story.
712
+ */
713
+ getCapabilities(): PkiBackendCapabilities;
714
+ generateKeyPairAndSignDER(options: GenerateKeyPairAndSignOptions): Promise<{
715
+ certificateDer: Buffer;
716
+ privateKey: PrivateKey;
717
+ }>;
718
+ /**
719
+ * Generate a new RSA key pair, create an internal CSR, sign it
720
+ * with this CA, and return the result as a PKCS#12 (PFX)
721
+ * buffer bundling the certificate, private key, and CA chain.
722
+ *
723
+ * The private key is **never stored** by the CA — it exists only
724
+ * in a temporary directory that is cleaned up after the operation.
725
+ *
726
+ * @param options - key generation, certificate, and PFX options
727
+ * @returns the PFX as a `Buffer`
728
+ */
729
+ generateKeyPairAndSignPFX(options: GenerateKeyPairAndSignPFXOptions): Promise<Buffer>;
730
+ /**
731
+ * Revoke a DER-encoded certificate and regenerate the CRL.
732
+ *
733
+ * Extracts the serial number from the certificate, then
734
+ * uses the stored cert file at `certs/<serial>.pem` for
735
+ * revocation — avoiding temp-file PEM format mismatches.
736
+ *
737
+ * @param certDer - the certificate as a DER-encoded buffer
738
+ * @param reason - CRL reason code
739
+ * (default: `"keyCompromise"`)
740
+ * @throws if the certificate's serial is not found in the CA
741
+ */
742
+ revokeCertificateDER(certDer: Buffer, reason?: string): Promise<void>;
743
+ /**
744
+ * Initialize the CA directory structure, generate the CA
745
+ * private key and self-signed certificate if they do not
746
+ * already exist.
747
+ */
748
+ initialize(): Promise<void>;
749
+ /**
750
+ * Initialize the CA directory structure and generate the
751
+ * private key + CSR **without signing**.
752
+ *
753
+ * Use this when the CA certificate will be signed by an
754
+ * external (third-party) root CA. After receiving the signed
755
+ * certificate, call {@link installCACertificate} to complete
756
+ * the setup.
757
+ *
758
+ * **Idempotent / restart-safe:**
759
+ * - If the CA certificate exists and is valid → `{ status: "ready" }`
760
+ * - If the CA certificate has expired → `{ status: "expired", csrPath, expiryDate }`
761
+ * (a new CSR is generated, preserving the existing private key)
762
+ * - If key + CSR exist but no cert (restart before install) →
763
+ * `{ status: "pending", csrPath }` without regenerating
764
+ * - Otherwise → generates key + CSR → `{ status: "created", csrPath }`
765
+ *
766
+ * @returns an {@link InitializeCSRResult} describing the CA state
767
+ */
768
+ initializeCSR(): Promise<InitializeCSRResult>;
769
+ /**
770
+ * Check whether the CA certificate needs renewal and, if so,
771
+ * generate a new CSR for re-signing by the external root CA.
772
+ *
773
+ * Use this while the CA is running to detect upcoming expiry
774
+ * **before** it actually expires. The existing private key is
775
+ * preserved so previously issued certs remain valid.
776
+ *
777
+ * @param thresholdDays - number of days before expiry at which
778
+ * to trigger renewal (default: 30)
779
+ * @returns an {@link InitializeCSRResult} — `"expired"` if
780
+ * renewal is needed, `"ready"` if the cert is still valid
781
+ */
782
+ renewCSR(thresholdDays?: number): Promise<InitializeCSRResult>;
783
+ /**
784
+ * Generate a CSR using the existing private key.
785
+ * Must be called under {@link #withCaLock} — the lock is taken by the
786
+ * public callers (`initializeCSR`, `renewCSR`), not here, so that
787
+ * `initializeCSR` can hold one lock across key generation AND CSR
788
+ * generation without the non-reentrant file lock deadlocking.
789
+ * @internal
790
+ */
791
+ private _generateCSR;
792
+ /**
793
+ * Install an externally-signed CA certificate and generate
794
+ * the initial CRL.
795
+ *
796
+ * Call this after {@link initializeCSR} once the external
797
+ * root CA has signed the CSR.
798
+ *
799
+ * **Safety checks:**
800
+ * - Verifies that the certificate's public key matches the
801
+ * CA private key before installing.
802
+ *
803
+ * @param signedCertFile - path to the PEM-encoded signed
804
+ * CA certificate (issued by the external root CA)
805
+ * @returns an {@link InstallCACertificateResult} with
806
+ * `status: "success"` or `status: "error"` and a `reason`
807
+ */
808
+ installCACertificate(signedCertFile: string): Promise<InstallCACertificateResult>;
809
+ /**
810
+ * Sign a CSR with CA extensions (`v3_ca`), producing a
811
+ * subordinate CA certificate.
812
+ *
813
+ * Unlike {@link signCertificateRequest} which signs with
814
+ * end-entity extensions (SANs, etc.), this method signs
815
+ * with `basicConstraints = CA:TRUE` and `keyUsage =
816
+ * keyCertSign, cRLSign`.
817
+ *
818
+ * @param certFile - output path for the signed CA cert (PEM)
819
+ * @param csrFile - path to the subordinate CA's CSR
820
+ * @param params - signing parameters
821
+ */
822
+ signCACertificateRequest(certFile: string, csrFile: string, params: {
823
+ validity?: number;
824
+ }): Promise<void>;
825
+ /**
826
+ * Rebuild the combined CA certificate + CRL file.
827
+ *
828
+ * This concatenates the CA certificate with the current
829
+ * revocation list so that OpenSSL can verify certificates
830
+ * with CRL checking enabled.
831
+ */
832
+ constructCACertificateWithCRL(): Promise<void>;
833
+ /**
834
+ * Append the CA certificate to a signed certificate file,
835
+ * creating a PEM certificate chain.
836
+ *
837
+ * @param certificate - path to the certificate file to extend
838
+ */
839
+ constructCertificateChain(certificate: Filename): Promise<void>;
840
+ /**
841
+ * Create a self-signed certificate using OpenSSL.
842
+ *
843
+ * @param certificateFile - output path for the signed certificate
844
+ * @param privateKey - path to the private key file
845
+ * @param params - certificate parameters (subject, validity, SANs)
846
+ */
847
+ createSelfSignedCertificate(certificateFile: Filename, privateKey: Filename, params: Params): Promise<void>;
848
+ /**
849
+ * Regenerate `crl/revocation_list.{crl,der}` from the current database
850
+ * state, without changing any certificate's status. Normally
851
+ * unnecessary — `revokeCertificate` already regenerates the CRL as
852
+ * part of revoking — but useful to force a refresh (e.g. after
853
+ * switching a CA's `backend` between `"openssl"` and `"native"`).
854
+ */
855
+ regenerateCrl(): Promise<void>;
856
+ /**
857
+ * Revoke a certificate and regenerate the CRL.
858
+ *
859
+ * @param certificate - path to the certificate file to revoke
860
+ * @param params - revocation parameters
861
+ * @param params.reason - CRL reason code
862
+ * (default `"keyCompromise"`)
863
+ */
864
+ revokeCertificate(certificate: Filename, params: Params): Promise<void>;
865
+ /**
866
+ * Sign a Certificate Signing Request (CSR) with this CA.
867
+ *
868
+ * The signed certificate is written to `certificate`, and the
869
+ * CA certificate chain plus CRL are appended to form a
870
+ * complete certificate chain.
871
+ *
872
+ * @param certificate - output path for the signed certificate
873
+ * @param certificateSigningRequestFilename - path to the CSR
874
+ * @param params1 - signing parameters (validity, dates, SANs)
875
+ * @returns the path to the signed certificate
876
+ */
877
+ signCertificateRequest(certificate: Filename, certificateSigningRequestFilename: Filename, params1: Params): Promise<Filename>;
878
+ /**
879
+ * Check that `certificate` really was signed by this CA, and throw if it
880
+ * was not.
881
+ *
882
+ * This used to do nothing: `openssl verify` crashes on Windows, so the
883
+ * check was left as a placeholder. It no longer needs a subprocess -
884
+ * `verifyCertificateSignature` does it in pure JS, the same way
885
+ * {@link CertificateManager} already validates a chain - so the check
886
+ * that `signCertificateRequest` always claimed to perform now actually
887
+ * happens on every issuance, whichever backend did the signing.
888
+ *
889
+ * Only the leading certificate is examined: the file may be a chain,
890
+ * and the rest of it is this CA's own certificate and its issuers.
891
+ *
892
+ * @param certificate - path to the certificate (or chain) to verify
893
+ */
894
+ verifyCertificate(certificate: Filename): Promise<void>;
895
+ }
896
+
897
+ /**
898
+ * Everything a {@link CertificateAuthorityCore} delegates to a signing backend:
899
+ * the operations that need the CA's private key, or that mutate the CA's
900
+ * certificate database (`index.txt`, `serial`, `crlnumber`,
901
+ * `certs/<SERIAL>.pem`, `crl/revocation_list.*`). Everything else — directory
902
+ * layout, PEM/DER file concatenation, `index.txt` *reading*, URL validation,
903
+ * passphrase handling, `initializeCSR`'s state machine — stays in
904
+ * {@link CertificateAuthorityCore} and is shared by every backend.
905
+ *
906
+ * Two implementations exist. `OpenSslCaBackend` shells out to the `openssl`
907
+ * CLI exactly as `CertificateAuthority` always has, and remains the default.
908
+ * `NativeCaBackend` does the same work in pure JS, which is what allows a
909
+ * CA key held by an HSM or KMS - one that only signs and never exposes key
910
+ * material - to be used at all: the openssl CLI can only load a key from a
911
+ * file. Both write the same on-disk database format, so an install can move
912
+ * between them and external `openssl` tooling keeps working either way.
913
+ */
914
+ interface CaBackend {
915
+ /**
916
+ * Whether this backend can sign with an external {@link CaSigner} - an
917
+ * HSM or KMS key that only signs and never exposes key material.
918
+ * `false` for a backend that can only load a key from a file, so the
919
+ * CA can refuse the combination up front instead of failing later.
920
+ */
921
+ readonly supportsExternalSigner: boolean;
922
+ /**
923
+ * Check whatever this backend needs before it can do any work, and
924
+ * throw if it is missing. `CertificateAuthority` calls it before
925
+ * delegating, so a missing prerequisite is reported once, up front,
926
+ * rather than as a failure part-way through an operation.
927
+ *
928
+ * This exists because the requirement is the backend's, not the CA's:
929
+ * the openssl backend needs the `openssl` executable on PATH, and the
930
+ * native one needs nothing at all. Asking the CA to know that is what
931
+ * made a `backend: "native"` CA refuse to issue a certificate on a
932
+ * machine without openssl installed.
933
+ */
934
+ preflight(): Promise<void>;
935
+ /**
936
+ * Generate the CA's private key (if missing) and its certificate:
937
+ * self-signed for a root CA, signed by `ca._issuerCA` for a subordinate.
938
+ * Also produces the initial CRL. Called once, from
939
+ * {@link CertificateAuthority.initialize}.
940
+ */
941
+ bootstrap(ca: CertificateAuthorityCore): Promise<void>;
942
+ /**
943
+ * Generate a CSR for the CA's own key (`[v3_ca_req]` profile) — used by
944
+ * `initializeCSR`/`renewCSR` when the CA certificate is signed
945
+ * externally.
946
+ */
947
+ generateCaCsr(ca: CertificateAuthorityCore, caRootDir: string, privateKeyFile: string, csrFile: string): Promise<void>;
948
+ /**
949
+ * Sign a subordinate CA's CSR with this CA's key (`[v3_ca]` profile).
950
+ * Used by {@link CertificateAuthority.signCACertificateRequest}.
951
+ */
952
+ signSubordinateCsr(ca: CertificateAuthorityCore, csrFile: string, certFile: string, validityDays: number): Promise<void>;
953
+ /**
954
+ * Sign an end-entity CSR with this CA's key (`[usr_cert]` profile via
955
+ * `openssl ca`) — the certificate database (`index.txt`, `serial`,
956
+ * `certs/<SERIAL>.pem`) is updated as a side effect. Used by
957
+ * {@link CertificateAuthority.signCertificateRequest}.
958
+ *
959
+ * `sanOverride` is the applicationUri/dns/ip the caller already
960
+ * re-derived from the CSR itself (SANs are not copied by `openssl ca`
961
+ * — see the comment at the call site), so the backend can render the
962
+ * `subjectAltName` extension without re-parsing the CSR.
963
+ */
964
+ signEndEntityCsr(ca: CertificateAuthorityCore, certificate: string, csr: string, params: Params, sanOverride: Required<ProcessAltNamesParam>): Promise<void>;
965
+ /**
966
+ * Mark a certificate revoked in the database and regenerate the CRL.
967
+ * Used by {@link CertificateAuthority.revokeCertificate}.
968
+ */
969
+ revoke(ca: CertificateAuthorityCore, certificate: string, reason: string): Promise<void>;
970
+ /**
971
+ * Regenerate `crl/revocation_list.{crl,der}` from the current database
972
+ * state, without changing any certificate's status. Used after
973
+ * {@link CertificateAuthority.installCACertificate} installs an
974
+ * externally-signed CA certificate.
975
+ */
976
+ regenerateCrl(ca: CertificateAuthorityCore): Promise<void>;
977
+ /**
978
+ * Legacy CLI self-signed certificate creation (`openssl req` +
979
+ * `openssl ca -selfsign`). Used by
980
+ * {@link CertificateAuthority.createSelfSignedCertificate}.
981
+ */
982
+ createSelfSignedCertificate(ca: CertificateAuthorityCore, certificateFile: string, privateKeyFile: string, params: Params): Promise<void>;
983
+ }
984
+
985
+ /**
986
+ * A native (pure-JS, no `openssl` child process) {@link CaBackend}: it
987
+ * bootstraps a CA, signs end-entity and subordinate-CA requests, revokes,
988
+ * and builds CRLs entirely through `node-opcua-crypto`'s signing
989
+ * primitives and {@link CaDatabase}'s write path, so the resulting
990
+ * `index.txt`/`serial`/`crlnumber`/`certs/` are the same on-disk format
991
+ * `openssl ca` produces and an install can move between backends.
992
+ *
993
+ * The signing key reaches every operation through
994
+ * `CertificateAuthority._getSigningKey()`, which yields either the on-disk
995
+ * key or an external `CaSigner`. Nothing below can tell the difference,
996
+ * which is the point: a CA whose key lives in an HSM never has a
997
+ * `private/cakey.pem` and never needs one.
998
+ *
999
+ * Two deliberate differences from the openssl backend, both improvements:
1000
+ * a subordinate CA's certificate is recorded in the issuer's `index.txt`
1001
+ * (`openssl x509 -CAserial` bumps the serial file but records nothing),
1002
+ * and a subordinate's SAN is taken from its own CSR rather than being
1003
+ * stamped with the issuer's.
1004
+ */
1005
+ declare class NativeCaBackend implements CaBackend {
1006
+ #private;
1007
+ /** Nothing to check: this backend spawns no process and needs no tool on PATH. */
1008
+ /** Signing goes through `ca._getSigningKey()`, which may be an external signer. */
1009
+ readonly supportsExternalSigner = true;
1010
+ preflight(): Promise<void>;
1011
+ /**
1012
+ * Write a CSR for the CA's own key, the `[v3_ca_req]` equivalent. The
1013
+ * key comes from the CA rather than from `privateKeyFile`: on a
1014
+ * signer-backed CA that file does not exist.
1015
+ */
1016
+ generateCaCsr(ca: CertificateAuthorityCore, _caRootDir: string, _privateKeyFile: string, csrFile: string): Promise<void>;
1017
+ bootstrap(ca: CertificateAuthorityCore): Promise<void>;
1018
+ /** Sign a subordinate CA's request with this CA's key, the `[v3_ca]` equivalent. */
1019
+ signSubordinateCsr(ca: CertificateAuthorityCore, csrFile: string, certFile: string, validityDays: number): Promise<void>;
1020
+ /**
1021
+ * Self-sign a certificate with a caller-supplied key file and record it
1022
+ * in this CA's database: the native equivalent of `openssl req -new`
1023
+ * followed by `openssl ca -selfsign`, which likewise applies the
1024
+ * end-entity profile and updates `index.txt`.
1025
+ */
1026
+ createSelfSignedCertificate(ca: CertificateAuthorityCore, certificateFile: string, privateKeyFile: string, params: Params): Promise<void>;
1027
+ signEndEntityCsr(ca: CertificateAuthorityCore, certificate: string, csr: string, params: Params, sanOverride: Required<ProcessAltNamesParam>): Promise<void>;
1028
+ regenerateCrl(ca: CertificateAuthorityCore): Promise<void>;
1029
+ revoke(ca: CertificateAuthorityCore, certificate: string, reason: string): Promise<void>;
1030
+ }
1031
+
1032
+ export { type CaBackend as C, type Filename as F, type GenerateKeyPairAndSignOptions as G, type InitializeCSRResult as I, type KeySize as K, NativeCaBackend as N, type Params as P, type SignCertificateOptions as S, type Thumbprint as T, CertificateAuthorityCore as a, type ProcessAltNamesParam as b, type CertificateAuthorityCoreOptions as c, type PrivateKeyPassphrase as d, type PrivateKeyProvider as e, type CreateSelfSignCertificateParam as f, type CertificateStatus as g, type CreateCertificateSigningRequestOptions as h, type CreateCertificateSigningRequestWithConfigOptions as i, type CreateSelfSignCertificateWithConfigParam as j, type GenerateKeyPairAndSignPFXOptions as k, type InstallCACertificateResult as l, type KeyLength as m, type PkiBackendCapabilities as n, type StartDateEndDateParam as o, adjustApplicationUri as p, adjustDate as q, quote as r, resolvePrivateKeyPassphrase as s, CaDatabase as t, type IssuedCertificateRecord as u, configurationFileTemplate as v, defaultSubject as w, escapeOpensslConfDoubleQuoted as x, renderCaConfig as y };