node-opcua-crypto 1.7.4 → 1.9.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 (102) hide show
  1. package/.fossa.yml +18 -18
  2. package/.github/FUNDING.yml +12 -12
  3. package/.github/workflows/main.yml +32 -32
  4. package/.prettierrc.js +6 -6
  5. package/LICENSE +22 -22
  6. package/README.md +14 -14
  7. package/dist/asn1.d.ts +69 -0
  8. package/dist/asn1.js +349 -0
  9. package/dist/asn1.js.map +1 -0
  10. package/dist/buffer_utils.d.ts +6 -0
  11. package/dist/buffer_utils.js +22 -0
  12. package/dist/buffer_utils.js.map +1 -0
  13. package/dist/common.d.ts +11 -0
  14. package/dist/common.js +3 -0
  15. package/dist/common.js.map +1 -0
  16. package/dist/crypto_explore_certificate.d.ts +95 -0
  17. package/dist/crypto_explore_certificate.js +547 -0
  18. package/dist/crypto_explore_certificate.js.map +1 -0
  19. package/dist/crypto_utils.d.ts +106 -0
  20. package/dist/crypto_utils.js +370 -0
  21. package/dist/crypto_utils.js.map +1 -0
  22. package/dist/derived_keys.d.ts +72 -0
  23. package/dist/derived_keys.js +247 -0
  24. package/dist/derived_keys.js.map +1 -0
  25. package/dist/explore_certificate.d.ts +30 -0
  26. package/dist/explore_certificate.js +44 -0
  27. package/dist/explore_certificate.js.map +1 -0
  28. package/dist/explore_certificate_revocation_list.d.ts +30 -0
  29. package/dist/explore_certificate_revocation_list.js +67 -0
  30. package/dist/explore_certificate_revocation_list.js.map +1 -0
  31. package/dist/index.d.ts +10 -0
  32. package/dist/index.js +23 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/oid_map.d.ts +7 -0
  35. package/dist/oid_map.js +262 -0
  36. package/dist/oid_map.js.map +1 -0
  37. package/dist/source/asn1.d.ts +73 -73
  38. package/dist/source/asn1.js +359 -359
  39. package/dist/source/buffer_utils.d.ts +6 -5
  40. package/dist/source/buffer_utils.js +21 -21
  41. package/dist/source/common.d.ts +12 -12
  42. package/dist/source/common.js +2 -2
  43. package/dist/source/crypto_explore_certificate.d.ts +107 -107
  44. package/dist/source/crypto_explore_certificate.js +600 -600
  45. package/dist/source/crypto_utils.d.ts +78 -78
  46. package/dist/source/crypto_utils.js +280 -280
  47. package/dist/source/derived_keys.d.ts +72 -72
  48. package/dist/source/derived_keys.js +248 -245
  49. package/dist/source/derived_keys.js.map +1 -1
  50. package/dist/source/explore_certificate.d.ts +30 -30
  51. package/dist/source/explore_certificate.js +43 -43
  52. package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
  53. package/dist/source/explore_certificate_revocation_list.js +44 -44
  54. package/dist/source/explore_certificate_signing_request.d.ts +13 -13
  55. package/dist/source/explore_certificate_signing_request.js +44 -44
  56. package/dist/source/explore_private_key.d.ts +29 -29
  57. package/dist/source/explore_private_key.js +96 -96
  58. package/dist/source/index.d.ts +13 -13
  59. package/dist/source/index.js +25 -25
  60. package/dist/source/oid_map.d.ts +7 -7
  61. package/dist/source/oid_map.js +303 -303
  62. package/dist/source/public_private_match.d.ts +3 -3
  63. package/dist/source/public_private_match.js +16 -16
  64. package/dist/source/verify_certificate_signature.d.ts +10 -10
  65. package/dist/source/verify_certificate_signature.js +101 -101
  66. package/dist/source_nodejs/index.d.ts +3 -3
  67. package/dist/source_nodejs/index.js +15 -15
  68. package/dist/source_nodejs/read.d.ts +29 -29
  69. package/dist/source_nodejs/read.js +94 -94
  70. package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
  71. package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
  72. package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
  73. package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
  74. package/dist/verify_cerficate_signature.d.ts +10 -0
  75. package/dist/verify_cerficate_signature.js +102 -0
  76. package/dist/verify_cerficate_signature.js.map +1 -0
  77. package/index.d.ts +2 -2
  78. package/index.js +4 -4
  79. package/index_web.js +3 -3
  80. package/package.json +17 -17
  81. package/source/asn1.ts +404 -404
  82. package/source/buffer_utils.ts +18 -18
  83. package/source/common.ts +13 -13
  84. package/source/crypto_explore_certificate.ts +763 -763
  85. package/source/crypto_utils.ts +321 -321
  86. package/source/derived_keys.ts +287 -284
  87. package/source/explore_certificate.ts +66 -66
  88. package/source/explore_certificate_revocation_list.ts +93 -93
  89. package/source/explore_certificate_signing_request.ts +58 -58
  90. package/source/explore_private_key.ts +121 -121
  91. package/source/index.ts +13 -13
  92. package/source/oid_map.ts +310 -310
  93. package/source/public_private_match.ts +17 -17
  94. package/source/verify_certificate_signature.ts +105 -105
  95. package/source_nodejs/index.ts +2 -2
  96. package/source_nodejs/read.ts +95 -95
  97. package/source_nodejs/read_certificate_revocation_list.ts +14 -14
  98. package/source_nodejs/read_certificate_signing_request.ts +17 -17
  99. package/test_certificate.ts +34 -34
  100. package/tsconfig.json +18 -18
  101. package/tslint.json +34 -34
  102. package/pnpm-lock.yaml +0 -1689
@@ -1,78 +1,78 @@
1
- /// <reference types="node" />
2
- import { Certificate, CertificatePEM, DER, PEM, PrivateKeyPEM, PublicKey, PublicKeyPEM, Signature } from "./common";
3
- export declare function identifyPemType(rawKey: Buffer | string): undefined | string;
4
- export declare function convertPEMtoDER(raw_key: PEM): DER;
5
- /**
6
- * @method toPem
7
- * @param raw_key
8
- * @param pem
9
- * @return
10
- */
11
- export declare function toPem(raw_key: Buffer | string, pem: string): string;
12
- export declare function hexDump(buffer: Buffer, width?: number): string;
13
- interface MakeMessageChunkSignatureOptions {
14
- signatureLength: number;
15
- algorithm: string;
16
- privateKey: CertificatePEM;
17
- }
18
- /**
19
- * @method makeMessageChunkSignature
20
- * @param chunk
21
- * @param options
22
- * @param options.signatureLength
23
- * @param options.algorithm for example "RSA-SHA256"
24
- * @param options.privateKey
25
- * @return - the signature
26
- */
27
- export declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
28
- export interface VerifyMessageChunkSignatureOptions {
29
- signatureLength?: number;
30
- algorithm: string;
31
- publicKey: PublicKeyPEM;
32
- }
33
- /**
34
- * @method verifyMessageChunkSignature
35
- *
36
- * const signer = {
37
- * signatureLength : 128,
38
- * algorithm : "RSA-SHA256",
39
- * publicKey: "qsdqsdqsd"
40
- * };
41
- * @param blockToVerify
42
- * @param signature
43
- * @param options
44
- * @param options.signatureLength
45
- * @param options.algorithm for example "RSA-SHA256"
46
- * @param options.publicKey
47
- * @return true if the signature is valid
48
- */
49
- export declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
50
- export declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
51
- export declare const RSA_PKCS1_OAEP_PADDING: number;
52
- export declare const RSA_PKCS1_PADDING: number;
53
- export declare enum PaddingAlgorithm {
54
- RSA_PKCS1_OAEP_PADDING = 4,
55
- RSA_PKCS1_PADDING = 1
56
- }
57
- export declare function publicEncrypt_native(buffer: Buffer, publicKey: PublicKeyPEM, algorithm?: PaddingAlgorithm): Buffer;
58
- export declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKeyPEM, algorithm?: PaddingAlgorithm): Buffer;
59
- export declare const publicEncrypt: typeof publicEncrypt_native;
60
- export declare const privateDecrypt: typeof privateDecrypt_native;
61
- export declare function publicEncrypt_long(buffer: Buffer, publicKey: PublicKeyPEM, blockSize: number, padding: number, algorithm?: PaddingAlgorithm): Buffer;
62
- export declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKeyPEM, blockSize: number, algorithm?: number): Buffer;
63
- export declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
64
- export declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
65
- /***
66
- * @method rsa_length
67
- * A very expensive way to determine the rsa key length ( i.e 2048bits or 1024bits)
68
- * @param key a PEM public key or a PEM rsa private key
69
- * @return { the key length in bytes.
70
- */
71
- export declare function rsa_length(key: PublicKeyPEM | PublicKey): number;
72
- export declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
73
- /**
74
- * extract the publickey from a certificate
75
- * @async
76
- */
77
- export declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
78
- export {};
1
+ /// <reference types="node" />
2
+ import { Certificate, CertificatePEM, DER, PEM, PrivateKeyPEM, PublicKey, PublicKeyPEM, Signature } from "./common";
3
+ export declare function identifyPemType(rawKey: Buffer | string): undefined | string;
4
+ export declare function convertPEMtoDER(raw_key: PEM): DER;
5
+ /**
6
+ * @method toPem
7
+ * @param raw_key
8
+ * @param pem
9
+ * @return
10
+ */
11
+ export declare function toPem(raw_key: Buffer | string, pem: string): string;
12
+ export declare function hexDump(buffer: Buffer, width?: number): string;
13
+ interface MakeMessageChunkSignatureOptions {
14
+ signatureLength: number;
15
+ algorithm: string;
16
+ privateKey: CertificatePEM;
17
+ }
18
+ /**
19
+ * @method makeMessageChunkSignature
20
+ * @param chunk
21
+ * @param options
22
+ * @param options.signatureLength
23
+ * @param options.algorithm for example "RSA-SHA256"
24
+ * @param options.privateKey
25
+ * @return - the signature
26
+ */
27
+ export declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
28
+ export interface VerifyMessageChunkSignatureOptions {
29
+ signatureLength?: number;
30
+ algorithm: string;
31
+ publicKey: PublicKeyPEM;
32
+ }
33
+ /**
34
+ * @method verifyMessageChunkSignature
35
+ *
36
+ * const signer = {
37
+ * signatureLength : 128,
38
+ * algorithm : "RSA-SHA256",
39
+ * publicKey: "qsdqsdqsd"
40
+ * };
41
+ * @param blockToVerify
42
+ * @param signature
43
+ * @param options
44
+ * @param options.signatureLength
45
+ * @param options.algorithm for example "RSA-SHA256"
46
+ * @param options.publicKey
47
+ * @return true if the signature is valid
48
+ */
49
+ export declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
50
+ export declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
51
+ export declare const RSA_PKCS1_OAEP_PADDING: number;
52
+ export declare const RSA_PKCS1_PADDING: number;
53
+ export declare enum PaddingAlgorithm {
54
+ RSA_PKCS1_OAEP_PADDING = 4,
55
+ RSA_PKCS1_PADDING = 1
56
+ }
57
+ export declare function publicEncrypt_native(buffer: Buffer, publicKey: PublicKeyPEM, algorithm?: PaddingAlgorithm): Buffer;
58
+ export declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKeyPEM, algorithm?: PaddingAlgorithm): Buffer;
59
+ export declare const publicEncrypt: typeof publicEncrypt_native;
60
+ export declare const privateDecrypt: typeof privateDecrypt_native;
61
+ export declare function publicEncrypt_long(buffer: Buffer, publicKey: PublicKeyPEM, blockSize: number, padding: number, algorithm?: PaddingAlgorithm): Buffer;
62
+ export declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKeyPEM, blockSize: number, algorithm?: number): Buffer;
63
+ export declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
64
+ export declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
65
+ /***
66
+ * @method rsa_length
67
+ * A very expensive way to determine the rsa key length ( i.e 2048bits or 1024bits)
68
+ * @param key a PEM public key or a PEM rsa private key
69
+ * @return { the key length in bytes.
70
+ */
71
+ export declare function rsa_length(key: PublicKeyPEM | PublicKey): number;
72
+ export declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
73
+ /**
74
+ * extract the publickey from a certificate
75
+ * @async
76
+ */
77
+ export declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
78
+ export {};