node-opcua-crypto-web 5.7.1 → 5.8.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/dist/index_web.d.ts +46 -6
- package/dist/index_web.js +62 -46
- package/package.json +2 -2
package/dist/index_web.d.ts
CHANGED
|
@@ -624,6 +624,8 @@ interface WebCryptoFromSigner {
|
|
|
624
624
|
* that key ever existing as an in-process `CryptoKey`.
|
|
625
625
|
*/
|
|
626
626
|
declare function webCryptoFromSigner(signer: CaSigner, baseCrypto?: Pick<Crypto, "subtle" | "getRandomValues">): Promise<WebCryptoFromSigner>;
|
|
627
|
+
/** True when `value` implements {@link CaSigner} rather than being a raw `CryptoKey`. */
|
|
628
|
+
declare function isCaSigner(value: CryptoKey | CaSigner): value is CaSigner;
|
|
627
629
|
/** The `crypto`/`signingKey` pair a `@peculiar/x509` generator needs, resolved from either a raw key or a {@link CaSigner}. */
|
|
628
630
|
interface ResolvedCaSigningKey {
|
|
629
631
|
crypto: Crypto;
|
|
@@ -638,6 +640,28 @@ interface ResolvedCaSigningKey {
|
|
|
638
640
|
* generation) need to branch on which kind of signing key they were given.
|
|
639
641
|
*/
|
|
640
642
|
declare function resolveCaSigningKey(signingKey: CryptoKey | CaSigner, baseCrypto?: Pick<Crypto, "subtle" | "getRandomValues">): Promise<ResolvedCaSigningKey>;
|
|
643
|
+
/**
|
|
644
|
+
* What a `@peculiar/x509` generator needs when it must sign with a key AND
|
|
645
|
+
* embed that same key's public half — a CSR, or a self-signed certificate.
|
|
646
|
+
* {@link resolveCaSigningKey} is not enough there: it yields no public key.
|
|
647
|
+
*/
|
|
648
|
+
interface ResolvedCaKeyPair {
|
|
649
|
+
crypto: Crypto;
|
|
650
|
+
keys: {
|
|
651
|
+
privateKey: CryptoKey;
|
|
652
|
+
publicKey: CryptoKey;
|
|
653
|
+
};
|
|
654
|
+
signingAlgorithm: CaSignAlgorithm;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Resolves a `CryptoKey | CaSigner` into the key pair and per-call `crypto`
|
|
658
|
+
* a CSR or self-signed-certificate generator needs.
|
|
659
|
+
*
|
|
660
|
+
* For a raw `CryptoKey` the public half is derived from the private one.
|
|
661
|
+
* For a {@link CaSigner} it comes from `getPublicKey()` — the only way to
|
|
662
|
+
* obtain it when the private key lives in an HSM and cannot be exported.
|
|
663
|
+
*/
|
|
664
|
+
declare function resolveCaKeyPair(key: CryptoKey | CaSigner, baseCrypto?: Pick<Crypto, "subtle" | "getRandomValues">): Promise<ResolvedCaKeyPair>;
|
|
641
665
|
|
|
642
666
|
/**
|
|
643
667
|
* @param privateKeyInDerOrPem
|
|
@@ -657,8 +681,14 @@ declare function _coercePrivateKey(privateKey: unknown): Promise<KeyObject>;
|
|
|
657
681
|
interface CreateCertificateFromCsrOptions {
|
|
658
682
|
/** The CSR to sign, PEM or DER encoded. */
|
|
659
683
|
csr: string | BufferSource;
|
|
660
|
-
/**
|
|
661
|
-
|
|
684
|
+
/**
|
|
685
|
+
* The issuing CA's subject. Prefer passing the issuer's parsed
|
|
686
|
+
* `subjectName` (`X509Certificate.subjectName`, or the CSR's own for a
|
|
687
|
+
* self-signed root) over a string: re-parsing a string form can change
|
|
688
|
+
* the DER encoding, and an issuer that is not byte-identical to the
|
|
689
|
+
* issuer certificate's subject breaks chain building.
|
|
690
|
+
*/
|
|
691
|
+
issuerName: x509.X509CertificateCreateParamsName;
|
|
662
692
|
/** The issuing CA's public key, used to derive the Authority Key Identifier extension. */
|
|
663
693
|
issuerPublicKey: PublicKeyType;
|
|
664
694
|
/** The issuing CA's signing key — a raw key, or an HSM/KMS-backed {@link CaSigner}. */
|
|
@@ -691,7 +721,13 @@ declare function createCertificateFromCsr(options: CreateCertificateFromCsrOptio
|
|
|
691
721
|
}>;
|
|
692
722
|
|
|
693
723
|
interface CreateCertificateSigningRequestOptions {
|
|
694
|
-
|
|
724
|
+
/**
|
|
725
|
+
* The requester's key. A raw `CryptoKey`, or a {@link CaSigner} when the
|
|
726
|
+
* private key lives in an HSM/KMS and cannot be exported - the public
|
|
727
|
+
* half is then taken from `getPublicKey()` and the proof-of-possession
|
|
728
|
+
* signature is produced by `sign()`.
|
|
729
|
+
*/
|
|
730
|
+
privateKey: CryptoKey | CaSigner;
|
|
695
731
|
notBefore?: Date;
|
|
696
732
|
notAfter?: Date;
|
|
697
733
|
validity?: number;
|
|
@@ -714,8 +750,12 @@ interface CreateCrlEntryOptions {
|
|
|
714
750
|
invalidity?: Date;
|
|
715
751
|
}
|
|
716
752
|
interface CreateCrlOptions {
|
|
717
|
-
/**
|
|
718
|
-
|
|
753
|
+
/**
|
|
754
|
+
* The issuing CA's subject. Prefer the issuer certificate's parsed
|
|
755
|
+
* `subjectName` over a string: a CRL whose issuer is not byte-identical
|
|
756
|
+
* to the issuer certificate's subject will not be matched to it.
|
|
757
|
+
*/
|
|
758
|
+
issuerName: x509.X509CertificateCreateParamsName;
|
|
719
759
|
/** The issuing CA's public key, used to derive the Authority Key Identifier extension. */
|
|
720
760
|
issuerPublicKey: PublicKeyType;
|
|
721
761
|
/** The issuing CA's signing key — a raw key, or an HSM/KMS-backed {@link CaSigner}. */
|
|
@@ -952,4 +992,4 @@ declare const asn1: {
|
|
|
952
992
|
readSignatureValueBin: typeof readSignatureValueBin;
|
|
953
993
|
};
|
|
954
994
|
|
|
955
|
-
export { type AttributeTypeAndValue, type AuthorityInformationAccess, type AuthorityKeyIdentifier, type BasicConstraints, type CaSignAlgorithm, type CaSigner, type Certificate, type CertificateExtension, type CertificateInfo, type CertificateInternals, type CertificatePEM, CertificatePurpose, type CertificateRevocationList, type CertificateRevocationListInfo, type CertificateSerialNumber, type CertificateSigningRequestInfo, type ComputeDerivedKeysOptions, type CreateCertificateFromCsrOptions, type CreateCrlEntryOptions, type CreateCrlOptions, type CreateSelfSignCertificateOptions, type DER, type DERContentType, type DerivedKeys, type DirectoryName, type DistinguishedNameAttribute, type ExtensionRequest, type Extensions, type KeyExportOptions, type KeyObject, LocalPrivateKeySigner, type Name, type Nonce, type PEM, PaddingAlgorithm, PfxIntegrityError, PfxMalformedError, Pkcs12UnsupportedAlgorithmError, type PrivateKey, type PrivateKeyInternals, type PrivateKeyPEM, PrivateKeyPassphraseRequiredError, type PublicKey, type PublicKeyLength, type PublicKeyPEM, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, type ResolvedCaSigningKey, type RevocationExtensionsParams, type RevokedCertificate, type Signature, Subject, type SubjectAltName, type SubjectOptions, type SubjectPublicKey, type SubjectPublicKeyInfo, type TBSCertList, type TbsCertificate, type Validity, type VerifyChunkSignatureOptions, type VerifyMessageChunkSignatureOptions, type Version, type WebCryptoFromSigner, type X509ExtKeyUsage, type X509KeyUsage, type _VerifyStatus, _coercePrivateKey, asn1, buildAuthorityKeyIdentifierFromIssuer, buildCrlNumberExtension, buildRevocationExtensions, certificateMatchesPrivateKey, clearExploreCertificateCache, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateFromCsr, createCertificateSigningRequest, createCrl, createPrivateKeyFromNodeJSCrypto, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, getCrypto, hexDump, identifyDERContent, identifyPemType, isCrlIssuedByCertificate, isKeyObject, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePrivateKeyThumbPrint, makePseudoRandomBuffer, makeSHA1Thumbprint, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToCryptoKey, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readExtension, readNameForCrl, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, resolveCaSigningKey, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyCrlIssuedByCertificate, verifyMessageChunkSignature, verify_certificate_der_structure, webCryptoFromSigner };
|
|
995
|
+
export { type AttributeTypeAndValue, type AuthorityInformationAccess, type AuthorityKeyIdentifier, type BasicConstraints, type CaSignAlgorithm, type CaSigner, type Certificate, type CertificateExtension, type CertificateInfo, type CertificateInternals, type CertificatePEM, CertificatePurpose, type CertificateRevocationList, type CertificateRevocationListInfo, type CertificateSerialNumber, type CertificateSigningRequestInfo, type ComputeDerivedKeysOptions, type CreateCertificateFromCsrOptions, type CreateCrlEntryOptions, type CreateCrlOptions, type CreateSelfSignCertificateOptions, type DER, type DERContentType, type DerivedKeys, type DirectoryName, type DistinguishedNameAttribute, type ExtensionRequest, type Extensions, type KeyExportOptions, type KeyObject, LocalPrivateKeySigner, type Name, type Nonce, type PEM, PaddingAlgorithm, PfxIntegrityError, PfxMalformedError, Pkcs12UnsupportedAlgorithmError, type PrivateKey, type PrivateKeyInternals, type PrivateKeyPEM, PrivateKeyPassphraseRequiredError, type PublicKey, type PublicKeyLength, type PublicKeyPEM, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, type ResolvedCaKeyPair, type ResolvedCaSigningKey, type RevocationExtensionsParams, type RevokedCertificate, type Signature, Subject, type SubjectAltName, type SubjectOptions, type SubjectPublicKey, type SubjectPublicKeyInfo, type TBSCertList, type TbsCertificate, type Validity, type VerifyChunkSignatureOptions, type VerifyMessageChunkSignatureOptions, type Version, type WebCryptoFromSigner, type X509ExtKeyUsage, type X509KeyUsage, type _VerifyStatus, _coercePrivateKey, asn1, buildAuthorityKeyIdentifierFromIssuer, buildCrlNumberExtension, buildRevocationExtensions, certificateMatchesPrivateKey, clearExploreCertificateCache, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateFromCsr, createCertificateSigningRequest, createCrl, createPrivateKeyFromNodeJSCrypto, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, getCrypto, hexDump, identifyDERContent, identifyPemType, isCaSigner, isCrlIssuedByCertificate, isKeyObject, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePrivateKeyThumbPrint, makePseudoRandomBuffer, makeSHA1Thumbprint, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToCryptoKey, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readExtension, readNameForCrl, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, resolveCaKeyPair, resolveCaSigningKey, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyCrlIssuedByCertificate, verifyMessageChunkSignature, verify_certificate_der_structure, webCryptoFromSigner };
|
package/dist/index_web.js
CHANGED
|
@@ -61691,6 +61691,10 @@ if (typeof window === "undefined") {
|
|
|
61691
61691
|
function getCrypto() {
|
|
61692
61692
|
return _crypto || crypto || node_crypto_shim_default;
|
|
61693
61693
|
}
|
|
61694
|
+
function ensurePemTrailingNewline(pem2) {
|
|
61695
|
+
return pem2.endsWith("\n") ? pem2 : `${pem2}
|
|
61696
|
+
`;
|
|
61697
|
+
}
|
|
61694
61698
|
|
|
61695
61699
|
// ../node-opcua-crypto/source/x509/build_ca_extensions.ts
|
|
61696
61700
|
init_inject_buffer();
|
|
@@ -61723,6 +61727,31 @@ function buildCrlNumberExtension(crlNumber) {
|
|
|
61723
61727
|
|
|
61724
61728
|
// ../node-opcua-crypto/source/x509/ca_signer.ts
|
|
61725
61729
|
init_inject_buffer();
|
|
61730
|
+
|
|
61731
|
+
// ../node-opcua-crypto/source/x509/_build_public_key.ts
|
|
61732
|
+
init_inject_buffer();
|
|
61733
|
+
async function buildPublicKey(privateKey) {
|
|
61734
|
+
const crypto4 = getCrypto();
|
|
61735
|
+
const jwk = await crypto4.subtle.exportKey("jwk", privateKey);
|
|
61736
|
+
delete jwk.d;
|
|
61737
|
+
delete jwk.dp;
|
|
61738
|
+
delete jwk.dq;
|
|
61739
|
+
delete jwk.q;
|
|
61740
|
+
delete jwk.qi;
|
|
61741
|
+
jwk.key_ops = [
|
|
61742
|
+
"encrypt",
|
|
61743
|
+
"sign"
|
|
61744
|
+
// "wrapKey"
|
|
61745
|
+
];
|
|
61746
|
+
const publicKey = await crypto4.subtle.importKey("jwk", jwk, { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } }, true, [
|
|
61747
|
+
// "encrypt",
|
|
61748
|
+
// "sign",
|
|
61749
|
+
// "wrapKey",
|
|
61750
|
+
]);
|
|
61751
|
+
return publicKey;
|
|
61752
|
+
}
|
|
61753
|
+
|
|
61754
|
+
// ../node-opcua-crypto/source/x509/ca_signer.ts
|
|
61726
61755
|
var LocalPrivateKeySigner = class {
|
|
61727
61756
|
algorithm;
|
|
61728
61757
|
#privateKey;
|
|
@@ -61786,6 +61815,21 @@ async function resolveCaSigningKey(signingKey, baseCrypto = getCrypto()) {
|
|
|
61786
61815
|
}
|
|
61787
61816
|
return { crypto: baseCrypto, signingKey };
|
|
61788
61817
|
}
|
|
61818
|
+
async function resolveCaKeyPair(key, baseCrypto = getCrypto()) {
|
|
61819
|
+
if (isCaSigner(key)) {
|
|
61820
|
+
const adapted = await webCryptoFromSigner(key, baseCrypto);
|
|
61821
|
+
return {
|
|
61822
|
+
crypto: adapted.crypto,
|
|
61823
|
+
keys: { privateKey: adapted.privateKeyHandle, publicKey: adapted.publicKey },
|
|
61824
|
+
signingAlgorithm: key.algorithm
|
|
61825
|
+
};
|
|
61826
|
+
}
|
|
61827
|
+
return {
|
|
61828
|
+
crypto: baseCrypto,
|
|
61829
|
+
keys: { privateKey: key, publicKey: await buildPublicKey(key) },
|
|
61830
|
+
signingAlgorithm: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } }
|
|
61831
|
+
};
|
|
61832
|
+
}
|
|
61789
61833
|
|
|
61790
61834
|
// ../node-opcua-crypto/source/x509/coerce_private_key.ts
|
|
61791
61835
|
init_inject_buffer();
|
|
@@ -61934,11 +61978,17 @@ async function createCertificateFromCsr(options) {
|
|
|
61934
61978
|
}
|
|
61935
61979
|
const extensions = [
|
|
61936
61980
|
basicConstraints,
|
|
61937
|
-
|
|
61981
|
+
// RFC 5280 4.2.1.12: extendedKeyUsage SHALL contain at least one
|
|
61982
|
+
// KeyPurposeId. getAttributes yields an empty list for a CA
|
|
61983
|
+
// certificate, so emitting it unconditionally would produce an
|
|
61984
|
+
// empty critical extension that a strict validator must reject.
|
|
61985
|
+
...keyUsageExtension.length > 0 ? [new x509_es_exports.ExtendedKeyUsageExtension(keyUsageExtension, true)] : [],
|
|
61938
61986
|
new x509_es_exports.KeyUsagesExtension(usages, true),
|
|
61939
61987
|
await x509_es_exports.SubjectKeyIdentifierExtension.create(csr.publicKey),
|
|
61940
61988
|
await buildAuthorityKeyIdentifierFromIssuer(options.issuerPublicKey, crypto4),
|
|
61941
|
-
|
|
61989
|
+
// an empty SubjectAlternativeName is an empty GeneralNames sequence,
|
|
61990
|
+
// which RFC 5280 4.2.1.6 does not permit - omit the extension instead
|
|
61991
|
+
...alternativeNameExtensions.length > 0 ? [new x509_es_exports.SubjectAlternativeNameExtension(alternativeNameExtensions)] : [],
|
|
61942
61992
|
...options.revocation ? buildRevocationExtensions(options.revocation) : []
|
|
61943
61993
|
];
|
|
61944
61994
|
const notBefore = options.notBefore ?? /* @__PURE__ */ new Date();
|
|
@@ -61959,36 +62009,11 @@ async function createCertificateFromCsr(options) {
|
|
|
61959
62009
|
},
|
|
61960
62010
|
signingCrypto
|
|
61961
62011
|
);
|
|
61962
|
-
return { cert: cert.toString("pem"), der: cert.rawData };
|
|
62012
|
+
return { cert: ensurePemTrailingNewline(cert.toString("pem")), der: cert.rawData };
|
|
61963
62013
|
}
|
|
61964
62014
|
|
|
61965
62015
|
// ../node-opcua-crypto/source/x509/create_certificate_signing_request.ts
|
|
61966
62016
|
init_inject_buffer();
|
|
61967
|
-
|
|
61968
|
-
// ../node-opcua-crypto/source/x509/_build_public_key.ts
|
|
61969
|
-
init_inject_buffer();
|
|
61970
|
-
async function buildPublicKey(privateKey) {
|
|
61971
|
-
const crypto4 = getCrypto();
|
|
61972
|
-
const jwk = await crypto4.subtle.exportKey("jwk", privateKey);
|
|
61973
|
-
delete jwk.d;
|
|
61974
|
-
delete jwk.dp;
|
|
61975
|
-
delete jwk.dq;
|
|
61976
|
-
delete jwk.q;
|
|
61977
|
-
delete jwk.qi;
|
|
61978
|
-
jwk.key_ops = [
|
|
61979
|
-
"encrypt",
|
|
61980
|
-
"sign"
|
|
61981
|
-
// "wrapKey"
|
|
61982
|
-
];
|
|
61983
|
-
const publicKey = await crypto4.subtle.importKey("jwk", jwk, { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } }, true, [
|
|
61984
|
-
// "encrypt",
|
|
61985
|
-
// "sign",
|
|
61986
|
-
// "wrapKey",
|
|
61987
|
-
]);
|
|
61988
|
-
return publicKey;
|
|
61989
|
-
}
|
|
61990
|
-
|
|
61991
|
-
// ../node-opcua-crypto/source/x509/create_certificate_signing_request.ts
|
|
61992
62017
|
async function createCertificateSigningRequest({
|
|
61993
62018
|
privateKey,
|
|
61994
62019
|
subject,
|
|
@@ -61997,19 +62022,7 @@ async function createCertificateSigningRequest({
|
|
|
61997
62022
|
applicationUri,
|
|
61998
62023
|
purpose
|
|
61999
62024
|
}) {
|
|
62000
|
-
const crypto4 =
|
|
62001
|
-
const modulusLength = 2048;
|
|
62002
|
-
const alg = {
|
|
62003
|
-
name: "RSASSA-PKCS1-v1_5",
|
|
62004
|
-
hash: { name: "SHA-256" },
|
|
62005
|
-
publicExponent: new Uint8Array([1, 0, 1]),
|
|
62006
|
-
modulusLength
|
|
62007
|
-
};
|
|
62008
|
-
const publicKey = await buildPublicKey(privateKey);
|
|
62009
|
-
const keys = {
|
|
62010
|
-
privateKey,
|
|
62011
|
-
publicKey
|
|
62012
|
-
};
|
|
62025
|
+
const { crypto: crypto4, keys, signingAlgorithm } = await resolveCaKeyPair(privateKey);
|
|
62013
62026
|
const alternativeNameExtensions = [];
|
|
62014
62027
|
for (const d of dns ?? []) {
|
|
62015
62028
|
alternativeNameExtensions.push({ type: "dns", value: d });
|
|
@@ -62028,7 +62041,7 @@ async function createCertificateSigningRequest({
|
|
|
62028
62041
|
{
|
|
62029
62042
|
name,
|
|
62030
62043
|
keys,
|
|
62031
|
-
signingAlgorithm
|
|
62044
|
+
signingAlgorithm,
|
|
62032
62045
|
extensions: [
|
|
62033
62046
|
basicConstraints,
|
|
62034
62047
|
new x509_es_exports.KeyUsagesExtension(usages, true),
|
|
@@ -62037,7 +62050,7 @@ async function createCertificateSigningRequest({
|
|
|
62037
62050
|
},
|
|
62038
62051
|
crypto4
|
|
62039
62052
|
);
|
|
62040
|
-
return { csr: csr.toString("pem"), der: csr };
|
|
62053
|
+
return { csr: ensurePemTrailingNewline(csr.toString("pem")), der: csr };
|
|
62041
62054
|
}
|
|
62042
62055
|
|
|
62043
62056
|
// ../node-opcua-crypto/source/x509/create_crl.ts
|
|
@@ -62068,7 +62081,7 @@ async function createCrl(options) {
|
|
|
62068
62081
|
},
|
|
62069
62082
|
signingCrypto
|
|
62070
62083
|
);
|
|
62071
|
-
const crlPem = x509_es_exports.PemConverter.encode(crl.rawData, "X509 CRL");
|
|
62084
|
+
const crlPem = ensurePemTrailingNewline(x509_es_exports.PemConverter.encode(crl.rawData, "X509 CRL"));
|
|
62072
62085
|
return { crl: crlPem, der: crl.rawData };
|
|
62073
62086
|
}
|
|
62074
62087
|
|
|
@@ -62132,7 +62145,8 @@ async function createSelfSignedCertificate({
|
|
|
62132
62145
|
new x509_es_exports.Extension(ID_NETSCAPE_COMMENT, false, AsnConvert.serialize(AsnUtf8StringConverter.toASN(nsComment))),
|
|
62133
62146
|
// new x509.BasicConstraintsExtension(true, 2, true),
|
|
62134
62147
|
basicConstraints,
|
|
62135
|
-
|
|
62148
|
+
// see RFC 5280 4.2.1.12 - an empty critical EKU is invalid
|
|
62149
|
+
...keyUsageExtension.length > 0 ? [new x509_es_exports.ExtendedKeyUsageExtension(keyUsageExtension, true)] : [],
|
|
62136
62150
|
new x509_es_exports.KeyUsagesExtension(usages, true),
|
|
62137
62151
|
await x509_es_exports.SubjectKeyIdentifierExtension.create(keys.publicKey),
|
|
62138
62152
|
await x509_es_exports.AuthorityKeyIdentifierExtension.create(keys.publicKey),
|
|
@@ -62141,7 +62155,7 @@ async function createSelfSignedCertificate({
|
|
|
62141
62155
|
},
|
|
62142
62156
|
crypto4
|
|
62143
62157
|
);
|
|
62144
|
-
return { cert: cert.toString("pem"), der: cert };
|
|
62158
|
+
return { cert: ensurePemTrailingNewline(cert.toString("pem")), der: cert };
|
|
62145
62159
|
}
|
|
62146
62160
|
|
|
62147
62161
|
// ../node-opcua-crypto/source/crypto_utils2.ts
|
|
@@ -62420,6 +62434,7 @@ export {
|
|
|
62420
62434
|
hexDump,
|
|
62421
62435
|
identifyDERContent,
|
|
62422
62436
|
identifyPemType,
|
|
62437
|
+
isCaSigner,
|
|
62423
62438
|
isCrlIssuedByCertificate,
|
|
62424
62439
|
isKeyObject,
|
|
62425
62440
|
makeMessageChunkSignature,
|
|
@@ -62445,6 +62460,7 @@ export {
|
|
|
62445
62460
|
reduceLength,
|
|
62446
62461
|
removePadding,
|
|
62447
62462
|
removeTrailingLF,
|
|
62463
|
+
resolveCaKeyPair,
|
|
62448
62464
|
resolveCaSigningKey,
|
|
62449
62465
|
rsaLengthPrivateKey,
|
|
62450
62466
|
rsaLengthPublicKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-crypto-web",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pre-bundled, zero-config browser build of node-opcua-crypto",
|
|
6
6
|
"//why": "This package exists so node-opcua-crypto can stay lean for Node. The pre-bundled browser build inlines its polyfills (crypto-browserify, stream-browserify, ...) and weighs ~344 KB gzip - more than the entire node-opcua-crypto tarball. Shipping it there would make every Node consumer download a browser bundle they never import. Browser consumers install this package explicitly, or let node-opcua-crypto's \"browser\" export condition redirect to it (see node-opcua-crypto/browser/index.js).",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"LICENSE",
|
|
68
68
|
"README.md"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "20bf526d2b82b6cdff47ad96d4fdf5f1b9155758"
|
|
71
71
|
}
|