node-opcua-crypto-web 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index_web.d.ts +18 -2
- package/dist/index_web.js +49 -20
- package/package.json +3 -3
package/dist/index_web.d.ts
CHANGED
|
@@ -379,10 +379,26 @@ type Version = string;
|
|
|
379
379
|
type Name = DirectoryName;
|
|
380
380
|
type CertificateSerialNumber = string;
|
|
381
381
|
type Extensions = Record<string, unknown>;
|
|
382
|
+
/**
|
|
383
|
+
* CRLReason, RFC 5280 §5.3.1 (value 7 is unused).
|
|
384
|
+
*/
|
|
385
|
+
type CRLReason = "unspecified" | "keyCompromise" | "cACompromise" | "affiliationChanged" | "superseded" | "cessationOfOperation" | "certificateHold" | "removeFromCRL" | "privilegeWithdrawn" | "aACompromise";
|
|
386
|
+
/**
|
|
387
|
+
* Decoded crlEntryExtensions (RFC 5280 §5.3).
|
|
388
|
+
* Known extensions get a named field; any other extension is kept under its
|
|
389
|
+
* dotted OID as the raw extnValue bytes.
|
|
390
|
+
*/
|
|
391
|
+
interface CrlEntryExtensions extends Extensions {
|
|
392
|
+
/** reasonCode (2.5.29.21); a value outside RFC 5280 is reported as `unknown(<n>)` */
|
|
393
|
+
reasonCode?: CRLReason | `unknown(${number})`;
|
|
394
|
+
/** invalidityDate (2.5.29.24) */
|
|
395
|
+
invalidityDate?: Date;
|
|
396
|
+
}
|
|
382
397
|
interface RevokedCertificate {
|
|
383
398
|
userCertificate: CertificateSerialNumber;
|
|
384
399
|
revocationDate: Date;
|
|
385
|
-
|
|
400
|
+
/** present only when the entry carries extensions */
|
|
401
|
+
crlEntryExtensions?: CrlEntryExtensions;
|
|
386
402
|
}
|
|
387
403
|
interface TBSCertList {
|
|
388
404
|
version?: Version;
|
|
@@ -1251,4 +1267,4 @@ declare const asn1: {
|
|
|
1251
1267
|
readSignatureValueBin: typeof readSignatureValueBin;
|
|
1252
1268
|
};
|
|
1253
1269
|
|
|
1254
|
-
export { type AsymmetricDecryptParams, type AsymmetricSignParams, 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 ECPrivateKeyInternals, type ExtensionRequest, type Extensions, type IKeyOperations, type KeyExportOptions, type KeyMetadata, type KeyObject, LocalKeyOperations, LocalPrivateKeySigner, type Name, type Nonce, type PEM, PaddingAlgorithm, PfxIntegrityError, PfxMalformedError, Pkcs12UnsupportedAlgorithmError, type PrivateKey, type PrivateKeyInternals, type PrivateKeyPEM, PrivateKeyPassphraseRequiredError, PrivateKeyUnavailableError, 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, caSignerFromKeyOperations, certificateMatchesPrivateKey, clearExploreCertificateCache, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateFromCsr, createCertificateSigningRequest, createCrl, createPrivateKeyFromNodeJSCrypto, createSelfSignedCertificate, decryptBufferWithDerivedKeys, decryptLong, decryptLongSync, derToPrivateKey, ecdsaSignatureDerToP1363, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, exploreEcPrivateKey, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, getCrypto, hasSyncKeyOperations, hexDump, identifyDERContent, identifyPemType, isCaSigner, isCrlIssuedByCertificate, isKeyObject, isKeyOperations, keyOperationsFromPrivateKey, 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 };
|
|
1270
|
+
export { type AsymmetricDecryptParams, type AsymmetricSignParams, type AttributeTypeAndValue, type AuthorityInformationAccess, type AuthorityKeyIdentifier, type BasicConstraints, type CRLReason, 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 CrlEntryExtensions, type DER, type DERContentType, type DerivedKeys, type DirectoryName, type DistinguishedNameAttribute, type ECPrivateKeyInternals, type ExtensionRequest, type Extensions, type IKeyOperations, type KeyExportOptions, type KeyMetadata, type KeyObject, LocalKeyOperations, LocalPrivateKeySigner, type Name, type Nonce, type PEM, PaddingAlgorithm, PfxIntegrityError, PfxMalformedError, Pkcs12UnsupportedAlgorithmError, type PrivateKey, type PrivateKeyInternals, type PrivateKeyPEM, PrivateKeyPassphraseRequiredError, PrivateKeyUnavailableError, 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, caSignerFromKeyOperations, certificateMatchesPrivateKey, clearExploreCertificateCache, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateFromCsr, createCertificateSigningRequest, createCrl, createPrivateKeyFromNodeJSCrypto, createSelfSignedCertificate, decryptBufferWithDerivedKeys, decryptLong, decryptLongSync, derToPrivateKey, ecdsaSignatureDerToP1363, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, exploreEcPrivateKey, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, getCrypto, hasSyncKeyOperations, hexDump, identifyDERContent, identifyPemType, isCaSigner, isCrlIssuedByCertificate, isKeyObject, isKeyOperations, keyOperationsFromPrivateKey, 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
|
@@ -47594,9 +47594,56 @@ function combine_der(certificates) {
|
|
|
47594
47594
|
|
|
47595
47595
|
// ../node-opcua-crypto/source/explore_certificate_revocation_list.ts
|
|
47596
47596
|
init_inject_buffer();
|
|
47597
|
+
var crlReasonNames = {
|
|
47598
|
+
0: "unspecified",
|
|
47599
|
+
1: "keyCompromise",
|
|
47600
|
+
2: "cACompromise",
|
|
47601
|
+
3: "affiliationChanged",
|
|
47602
|
+
4: "superseded",
|
|
47603
|
+
5: "cessationOfOperation",
|
|
47604
|
+
6: "certificateHold",
|
|
47605
|
+
8: "removeFromCRL",
|
|
47606
|
+
9: "privilegeWithdrawn",
|
|
47607
|
+
10: "aACompromise"
|
|
47608
|
+
};
|
|
47597
47609
|
function readNameForCrl(buffer, block) {
|
|
47598
47610
|
return readDirectoryName(buffer, block);
|
|
47599
47611
|
}
|
|
47612
|
+
function _readCrlEntryExtensions(buffer, block) {
|
|
47613
|
+
const result = {};
|
|
47614
|
+
for (const extensionBlock of readStruct(buffer, block)) {
|
|
47615
|
+
const inner = readStruct(buffer, extensionBlock);
|
|
47616
|
+
const { oid } = readObjectIdentifier(buffer, inner[0]);
|
|
47617
|
+
const extnValue = inner[inner.length - 1];
|
|
47618
|
+
const value = readTag(buffer, extnValue.position);
|
|
47619
|
+
switch (oid) {
|
|
47620
|
+
case "2.5.29.21": {
|
|
47621
|
+
const code = readIntegerValue(buffer, { ...value, tag: 2 /* INTEGER */ });
|
|
47622
|
+
result.reasonCode = crlReasonNames[code] ?? `unknown(${code})`;
|
|
47623
|
+
break;
|
|
47624
|
+
}
|
|
47625
|
+
case "2.5.29.24":
|
|
47626
|
+
result.invalidityDate = readTime(buffer, value);
|
|
47627
|
+
break;
|
|
47628
|
+
default:
|
|
47629
|
+
result[oid] = getBlock(buffer, extnValue);
|
|
47630
|
+
}
|
|
47631
|
+
}
|
|
47632
|
+
return result;
|
|
47633
|
+
}
|
|
47634
|
+
function _readRevokedCertificates(buffer, block) {
|
|
47635
|
+
return readStruct(buffer, block).map((r) => {
|
|
47636
|
+
const rr = readStruct(buffer, r);
|
|
47637
|
+
const revokedCertificate = {
|
|
47638
|
+
revocationDate: readTime(buffer, rr[1]),
|
|
47639
|
+
userCertificate: formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]))
|
|
47640
|
+
};
|
|
47641
|
+
if (rr[2]) {
|
|
47642
|
+
revokedCertificate.crlEntryExtensions = _readCrlEntryExtensions(buffer, rr[2]);
|
|
47643
|
+
}
|
|
47644
|
+
return revokedCertificate;
|
|
47645
|
+
});
|
|
47646
|
+
}
|
|
47600
47647
|
function _readTbsCertList(buffer, blockInfo) {
|
|
47601
47648
|
const blocks = readStruct(buffer, blockInfo);
|
|
47602
47649
|
const hasOptionalVersion = blocks[0].tag === 2 /* INTEGER */;
|
|
@@ -47609,16 +47656,7 @@ function _readTbsCertList(buffer, blockInfo) {
|
|
|
47609
47656
|
const nextUpdate = readTime(buffer, blocks[4]);
|
|
47610
47657
|
const revokedCertificates = [];
|
|
47611
47658
|
if (blocks[5] && blocks[5].tag < 128) {
|
|
47612
|
-
|
|
47613
|
-
for (const r of list) {
|
|
47614
|
-
const rr = readStruct(buffer, r);
|
|
47615
|
-
const userCertificate = formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]));
|
|
47616
|
-
const revocationDate = readTime(buffer, rr[1]);
|
|
47617
|
-
revokedCertificates.push({
|
|
47618
|
-
revocationDate,
|
|
47619
|
-
userCertificate
|
|
47620
|
-
});
|
|
47621
|
-
}
|
|
47659
|
+
revokedCertificates.push(..._readRevokedCertificates(buffer, blocks[5]));
|
|
47622
47660
|
}
|
|
47623
47661
|
const _ext0 = findBlockAtIndex(blocks, 0);
|
|
47624
47662
|
return { issuer, issuerFingerprint, thisUpdate, nextUpdate, signature, revokedCertificates };
|
|
@@ -47630,16 +47668,7 @@ function _readTbsCertList(buffer, blockInfo) {
|
|
|
47630
47668
|
const nextUpdate = readTime(buffer, blocks[3]);
|
|
47631
47669
|
const revokedCertificates = [];
|
|
47632
47670
|
if (blocks[4] && blocks[4].tag < 128) {
|
|
47633
|
-
|
|
47634
|
-
for (const r of list) {
|
|
47635
|
-
const rr = readStruct(buffer, r);
|
|
47636
|
-
const userCertificate = formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]));
|
|
47637
|
-
const revocationDate = readTime(buffer, rr[1]);
|
|
47638
|
-
revokedCertificates.push({
|
|
47639
|
-
revocationDate,
|
|
47640
|
-
userCertificate
|
|
47641
|
-
});
|
|
47642
|
-
}
|
|
47671
|
+
revokedCertificates.push(..._readRevokedCertificates(buffer, blocks[4]));
|
|
47643
47672
|
}
|
|
47644
47673
|
return { issuer, issuerFingerprint, thisUpdate, nextUpdate, signature, revokedCertificates };
|
|
47645
47674
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-crypto-web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.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).",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"crypto-browserify": "^3.12.1",
|
|
45
45
|
"esbuild": "^0.28.2",
|
|
46
46
|
"events": "^3.3.0",
|
|
47
|
-
"node-opcua-crypto": "^6.
|
|
47
|
+
"node-opcua-crypto": "^6.1.0",
|
|
48
48
|
"path-browserify": "^1.0.1",
|
|
49
49
|
"process": "^0.11.10",
|
|
50
50
|
"stream-browserify": "^3.0.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"LICENSE",
|
|
68
68
|
"README.md"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "7f4b387bafa2317d7a4038c23605ab2891cfc9f0"
|
|
71
71
|
}
|