node-opcua-crypto 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.fossa.yml +18 -18
  2. package/.github/FUNDING.yml +12 -12
  3. package/.github/workflows/main.yml +106 -106
  4. package/.prettierrc.js +6 -6
  5. package/LICENSE +23 -23
  6. package/README.md +14 -14
  7. package/dist/source/asn1.d.ts +73 -73
  8. package/dist/source/asn1.js +359 -359
  9. package/dist/source/buffer_utils.d.ts +6 -6
  10. package/dist/source/buffer_utils.js +21 -21
  11. package/dist/source/common.d.ts +14 -14
  12. package/dist/source/common.js +2 -2
  13. package/dist/source/crypto_explore_certificate.d.ts +107 -107
  14. package/dist/source/crypto_explore_certificate.js +601 -601
  15. package/dist/source/crypto_utils.d.ts +76 -76
  16. package/dist/source/crypto_utils.js +329 -329
  17. package/dist/source/crypto_utils.js.map +1 -1
  18. package/dist/source/derived_keys.d.ts +72 -72
  19. package/dist/source/derived_keys.js +248 -248
  20. package/dist/source/explore_certificate.d.ts +30 -30
  21. package/dist/source/explore_certificate.js +43 -43
  22. package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
  23. package/dist/source/explore_certificate_revocation_list.js +69 -69
  24. package/dist/source/explore_certificate_signing_request.d.ts +13 -13
  25. package/dist/source/explore_certificate_signing_request.js +44 -44
  26. package/dist/source/explore_private_key.d.ts +29 -29
  27. package/dist/source/explore_private_key.js +97 -97
  28. package/dist/source/index.d.ts +13 -13
  29. package/dist/source/index.js +29 -29
  30. package/dist/source/oid_map.d.ts +7 -7
  31. package/dist/source/oid_map.js +303 -303
  32. package/dist/source/public_private_match.d.ts +3 -3
  33. package/dist/source/public_private_match.js +36 -36
  34. package/dist/source/verify_certificate_signature.d.ts +10 -10
  35. package/dist/source/verify_certificate_signature.js +101 -101
  36. package/dist/source_nodejs/index.d.ts +3 -3
  37. package/dist/source_nodejs/index.js +19 -19
  38. package/dist/source_nodejs/read.d.ts +23 -23
  39. package/dist/source_nodejs/read.js +106 -106
  40. package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
  41. package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
  42. package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
  43. package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
  44. package/index.d.ts +2 -2
  45. package/index.js +4 -4
  46. package/index_web.js +3 -3
  47. package/package.json +9 -9
  48. package/source/asn1.ts +404 -404
  49. package/source/buffer_utils.ts +18 -18
  50. package/source/crypto_explore_certificate.ts +764 -764
  51. package/source/crypto_utils.ts +1 -1
  52. package/source/derived_keys.ts +287 -287
  53. package/source/explore_certificate.ts +66 -66
  54. package/source/explore_certificate_revocation_list.ts +122 -122
  55. package/source/explore_certificate_signing_request.ts +58 -58
  56. package/source/index.ts +13 -13
  57. package/source/oid_map.ts +310 -310
  58. package/source/verify_certificate_signature.ts +105 -105
  59. package/source_nodejs/index.ts +2 -2
  60. package/source_nodejs/read_certificate_revocation_list.ts +14 -14
  61. package/source_nodejs/read_certificate_signing_request.ts +17 -17
  62. package/test_certificate.ts +34 -34
  63. package/tsconfig.json +18 -18
  64. package/tslint.json +34 -34
  65. package/dist/source/certificate_matches_private_key.d.ts +0 -2
  66. package/dist/source/certificate_matches_private_key.js +0 -22
  67. package/dist/source/certificate_matches_private_key.js.map +0 -1
@@ -1,76 +1,76 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import * as crypto from "crypto";
4
- import { Certificate, CertificatePEM, DER, PEM, PrivateKey, PrivateKeyPEM, PublicKey, PublicKeyPEM, Signature } from "./common";
5
- export declare function identifyPemType(rawKey: Buffer | string): undefined | string;
6
- export declare function convertPEMtoDER(raw_key: PEM): DER;
7
- /**
8
- * @method toPem
9
- * @param raw_key
10
- * @param pem
11
- * @return
12
- */
13
- export declare function toPem(raw_key: Buffer | string | crypto.KeyObject, pem: string): string;
14
- export declare function hexDump(buffer: Buffer, width?: number): string;
15
- interface MakeMessageChunkSignatureOptions {
16
- signatureLength: number;
17
- algorithm: string;
18
- privateKey: PrivateKey;
19
- }
20
- export declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
21
- export interface VerifyMessageChunkSignatureOptions {
22
- signatureLength?: number;
23
- algorithm: string;
24
- publicKey: PublicKeyPEM;
25
- }
26
- /**
27
- * @method verifyMessageChunkSignature
28
- *
29
- * const signer = {
30
- * signatureLength : 128,
31
- * algorithm : "RSA-SHA256",
32
- * publicKey: "qsdqsdqsd"
33
- * };
34
- * @param blockToVerify
35
- * @param signature
36
- * @param options
37
- * @param options.signatureLength
38
- * @param options.algorithm for example "RSA-SHA256"
39
- * @param options.publicKey
40
- * @return true if the signature is valid
41
- */
42
- export declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
43
- export declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
44
- export declare const RSA_PKCS1_OAEP_PADDING: number;
45
- export declare const RSA_PKCS1_PADDING: number;
46
- export declare enum PaddingAlgorithm {
47
- RSA_PKCS1_OAEP_PADDING = 4,
48
- RSA_PKCS1_PADDING = 1
49
- }
50
- export declare function publicEncrypt_native(buffer: Buffer, publicKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
51
- export declare function privateDecrypt_native(buffer: Buffer, privateKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
52
- export declare const publicEncrypt: typeof publicEncrypt_native;
53
- export declare const privateDecrypt: typeof privateDecrypt_native;
54
- export declare function publicEncrypt_long(buffer: Buffer, publicKey: crypto.KeyLike, blockSize: number, padding: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
55
- export declare function privateDecrypt_long(buffer: Buffer, privateKey: crypto.KeyLike, blockSize: number, paddingAlgorithm?: number): Buffer;
56
- export declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
57
- export declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
58
- export declare function coerceRsaPublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
59
- export declare function coercePrivateKey(privateKey: PrivateKey | PrivateKeyPEM): PrivateKey;
60
- export declare function coercePrivateKeyPem(privateKey: PrivateKey | PrivateKeyPEM): PrivateKeyPEM;
61
- /***
62
- * @method rsaLengthPrivateKey
63
- * A very expensive way to determine the rsa key length ( i.e 2048bits or 1024bits)
64
- * @param key a PEM public key or a PEM rsa private key
65
- * @return the key length in bytes.
66
- */
67
- export declare function rsaLengthPrivateKey(key: PrivateKeyPEM | PrivateKey): number;
68
- export declare function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number;
69
- export declare function rsaLengthRsaPublicKey(key: PublicKeyPEM | PublicKey): number;
70
- export declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
71
- /**
72
- * extract the publickey from a certificate
73
- * @async
74
- */
75
- export declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
76
- export {};
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import * as crypto from "crypto";
4
+ import { Certificate, CertificatePEM, DER, PEM, PrivateKey, PrivateKeyPEM, PublicKey, PublicKeyPEM, Signature } from "./common";
5
+ export declare function identifyPemType(rawKey: Buffer | string): undefined | string;
6
+ export declare function convertPEMtoDER(raw_key: PEM): DER;
7
+ /**
8
+ * @method toPem
9
+ * @param raw_key
10
+ * @param pem
11
+ * @return
12
+ */
13
+ export declare function toPem(raw_key: Buffer | string | crypto.KeyObject, pem: string): string;
14
+ export declare function hexDump(buffer: Buffer, width?: number): string;
15
+ interface MakeMessageChunkSignatureOptions {
16
+ signatureLength: number;
17
+ algorithm: string;
18
+ privateKey: PrivateKey;
19
+ }
20
+ export declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
21
+ export interface VerifyMessageChunkSignatureOptions {
22
+ signatureLength?: number;
23
+ algorithm: string;
24
+ publicKey: PublicKeyPEM;
25
+ }
26
+ /**
27
+ * @method verifyMessageChunkSignature
28
+ *
29
+ * const signer = {
30
+ * signatureLength : 128,
31
+ * algorithm : "RSA-SHA256",
32
+ * publicKey: "qsdqsdqsd"
33
+ * };
34
+ * @param blockToVerify
35
+ * @param signature
36
+ * @param options
37
+ * @param options.signatureLength
38
+ * @param options.algorithm for example "RSA-SHA256"
39
+ * @param options.publicKey
40
+ * @return true if the signature is valid
41
+ */
42
+ export declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
43
+ export declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
44
+ export declare const RSA_PKCS1_OAEP_PADDING: number;
45
+ export declare const RSA_PKCS1_PADDING: number;
46
+ export declare enum PaddingAlgorithm {
47
+ RSA_PKCS1_OAEP_PADDING = 4,
48
+ RSA_PKCS1_PADDING = 1
49
+ }
50
+ export declare function publicEncrypt_native(buffer: Buffer, publicKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
51
+ export declare function privateDecrypt_native(buffer: Buffer, privateKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
52
+ export declare const publicEncrypt: typeof publicEncrypt_native;
53
+ export declare const privateDecrypt: typeof privateDecrypt_native;
54
+ export declare function publicEncrypt_long(buffer: Buffer, publicKey: crypto.KeyLike, blockSize: number, padding: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
55
+ export declare function privateDecrypt_long(buffer: Buffer, privateKey: crypto.KeyLike, blockSize: number, paddingAlgorithm?: number): Buffer;
56
+ export declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
57
+ export declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
58
+ export declare function coerceRsaPublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
59
+ export declare function coercePrivateKey(privateKey: PrivateKey | PrivateKeyPEM): PrivateKey;
60
+ export declare function coercePrivateKeyPem(privateKey: PrivateKey | PrivateKeyPEM): PrivateKeyPEM;
61
+ /***
62
+ * @method rsaLengthPrivateKey
63
+ * A very expensive way to determine the rsa key length ( i.e 2048bits or 1024bits)
64
+ * @param key a PEM public key or a PEM rsa private key
65
+ * @return the key length in bytes.
66
+ */
67
+ export declare function rsaLengthPrivateKey(key: PrivateKeyPEM | PrivateKey): number;
68
+ export declare function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number;
69
+ export declare function rsaLengthRsaPublicKey(key: PublicKeyPEM | PublicKey): number;
70
+ export declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
71
+ /**
72
+ * extract the publickey from a certificate
73
+ * @async
74
+ */
75
+ export declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
76
+ export {};