node-opcua-crypto 2.1.2 → 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 (65) 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/derived_keys.d.ts +72 -72
  18. package/dist/source/derived_keys.js +248 -248
  19. package/dist/source/explore_certificate.d.ts +30 -30
  20. package/dist/source/explore_certificate.js +43 -43
  21. package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
  22. package/dist/source/explore_certificate_revocation_list.js +69 -69
  23. package/dist/source/explore_certificate_signing_request.d.ts +13 -13
  24. package/dist/source/explore_certificate_signing_request.js +44 -44
  25. package/dist/source/explore_private_key.d.ts +29 -29
  26. package/dist/source/explore_private_key.js +97 -97
  27. package/dist/source/index.d.ts +13 -13
  28. package/dist/source/index.js +29 -29
  29. package/dist/source/oid_map.d.ts +7 -7
  30. package/dist/source/oid_map.js +303 -303
  31. package/dist/source/public_private_match.d.ts +3 -3
  32. package/dist/source/public_private_match.js +36 -36
  33. package/dist/source/verify_certificate_signature.d.ts +10 -10
  34. package/dist/source/verify_certificate_signature.js +101 -101
  35. package/dist/source_nodejs/index.d.ts +3 -3
  36. package/dist/source_nodejs/index.js +19 -19
  37. package/dist/source_nodejs/read.d.ts +23 -23
  38. package/dist/source_nodejs/read.js +106 -106
  39. package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
  40. package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
  41. package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
  42. package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
  43. package/index.d.ts +2 -2
  44. package/index.js +4 -4
  45. package/index_web.js +3 -3
  46. package/package.json +9 -9
  47. package/source/asn1.ts +404 -404
  48. package/source/buffer_utils.ts +18 -18
  49. package/source/crypto_explore_certificate.ts +764 -764
  50. package/source/derived_keys.ts +287 -287
  51. package/source/explore_certificate.ts +66 -66
  52. package/source/explore_certificate_revocation_list.ts +122 -122
  53. package/source/explore_certificate_signing_request.ts +58 -58
  54. package/source/index.ts +13 -13
  55. package/source/oid_map.ts +310 -310
  56. package/source/verify_certificate_signature.ts +105 -105
  57. package/source_nodejs/index.ts +2 -2
  58. package/source_nodejs/read_certificate_revocation_list.ts +14 -14
  59. package/source_nodejs/read_certificate_signing_request.ts +17 -17
  60. package/test_certificate.ts +34 -34
  61. package/tsconfig.json +18 -18
  62. package/tslint.json +34 -34
  63. package/dist/source/certificate_matches_private_key.d.ts +0 -2
  64. package/dist/source/certificate_matches_private_key.js +0 -22
  65. package/dist/source/certificate_matches_private_key.js.map +0 -1
package/.fossa.yml CHANGED
@@ -1,18 +1,18 @@
1
- # Generated by FOSSA CLI (https://github.com/fossas/fossa-cli)
2
- # Visit https://fossa.com to learn more
3
-
4
- version: 2
5
- cli:
6
- server: https://app.fossa.com
7
- fetcher: custom
8
- project: https://github.com/node-opcua/node-opcua-crypto
9
- analyze:
10
- modules:
11
- - name: .
12
- type: npm
13
- target: .
14
- path: .
15
- - name: .
16
- type: npm
17
- target: .
18
- path: .
1
+ # Generated by FOSSA CLI (https://github.com/fossas/fossa-cli)
2
+ # Visit https://fossa.com to learn more
3
+
4
+ version: 2
5
+ cli:
6
+ server: https://app.fossa.com
7
+ fetcher: custom
8
+ project: https://github.com/node-opcua/node-opcua-crypto
9
+ analyze:
10
+ modules:
11
+ - name: .
12
+ type: npm
13
+ target: .
14
+ path: .
15
+ - name: .
16
+ type: npm
17
+ target: .
18
+ path: .
@@ -1,12 +1,12 @@
1
- # These are supported funding model platforms
2
-
3
- github: [erossignon]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
1
+ # These are supported funding model platforms
2
+
3
+ github: [erossignon]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,106 +1,106 @@
1
- # This is a basic workflow to help you get started with Actions
2
-
3
- name: CI
4
-
5
- # Controls when the workflow will run
6
- on:
7
- # Triggers the workflow on push or pull request events but only for the master branch
8
- push:
9
- branches: [master]
10
- pull_request:
11
- branches: [master]
12
-
13
- # Allows you to run this workflow manually from the Actions tab
14
- workflow_dispatch:
15
-
16
- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
17
- jobs:
18
- # This workflow contains a single job called "build"
19
- build-new:
20
- # The type of runner that the job will run on
21
- strategy:
22
- matrix:
23
- node-version: [19.x]
24
- os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
25
- runs-on: ${{ matrix.os }}
26
- # Steps represent a sequence of tasks that will be executed as part of the job
27
- steps:
28
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
29
- - name: checkout
30
- uses: actions/checkout@v3
31
-
32
- - name: Use Node.js ${{ matrix.node-version }}
33
- uses: actions/setup-node@v3
34
- with:
35
- node-version: ${{ matrix.node-version }}
36
-
37
- - name: openssl
38
- run: openssl version
39
- - name: nodejs
40
- run: node --version
41
-
42
- # Runs a set of commands using the runners shell
43
- - name: build
44
- run: |
45
- npm install typescript mocha ts-node @types/node@18 npm -g
46
- npm install
47
- npm run test
48
- build:
49
- # The type of runner that the job will run on
50
- strategy:
51
- matrix:
52
- node-version: [ 16.x, 18.x]
53
- os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
54
- runs-on: ${{ matrix.os }}
55
- # Steps represent a sequence of tasks that will be executed as part of the job
56
- steps:
57
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
58
- - name: checkout
59
- uses: actions/checkout@v3
60
-
61
- - name: Use Node.js ${{ matrix.node-version }}
62
- uses: actions/setup-node@v3
63
- with:
64
- node-version: ${{ matrix.node-version }}
65
-
66
- - name: openssl
67
- run: openssl version
68
- - name: nodejs
69
- run: node --version
70
-
71
- # Runs a set of commands using the runners shell
72
- - name: build
73
- run: |
74
- npm install npm@9 -g
75
- npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} -g
76
- npm install
77
- npm run test
78
- build-legacy:
79
- # The type of runner that the job will run on
80
- strategy:
81
- matrix:
82
- node-version: [12.x, 14.x]
83
- os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
84
- runs-on: ${{ matrix.os }}
85
- # Steps represent a sequence of tasks that will be executed as part of the job
86
- steps:
87
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
88
- - name: checkout
89
- uses: actions/checkout@v3
90
-
91
- - name: Use Node.js ${{ matrix.node-version }}
92
- uses: actions/setup-node@v3
93
- with:
94
- node-version: ${{ matrix.node-version }}
95
-
96
- - name: openssl
97
- run: openssl version
98
- - name: nodejs
99
- run: node --version
100
-
101
- # Runs a set of commands using the runners shell
102
- - name: build
103
- run: |
104
- npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} npm@8 -g
105
- npm install
106
- npm run test
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name: CI
4
+
5
+ # Controls when the workflow will run
6
+ on:
7
+ # Triggers the workflow on push or pull request events but only for the master branch
8
+ push:
9
+ branches: [master]
10
+ pull_request:
11
+ branches: [master]
12
+
13
+ # Allows you to run this workflow manually from the Actions tab
14
+ workflow_dispatch:
15
+
16
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
17
+ jobs:
18
+ # This workflow contains a single job called "build"
19
+ build-new:
20
+ # The type of runner that the job will run on
21
+ strategy:
22
+ matrix:
23
+ node-version: [19.x]
24
+ os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
25
+ runs-on: ${{ matrix.os }}
26
+ # Steps represent a sequence of tasks that will be executed as part of the job
27
+ steps:
28
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
29
+ - name: checkout
30
+ uses: actions/checkout@v3
31
+
32
+ - name: Use Node.js ${{ matrix.node-version }}
33
+ uses: actions/setup-node@v3
34
+ with:
35
+ node-version: ${{ matrix.node-version }}
36
+
37
+ - name: openssl
38
+ run: openssl version
39
+ - name: nodejs
40
+ run: node --version
41
+
42
+ # Runs a set of commands using the runners shell
43
+ - name: build
44
+ run: |
45
+ npm install typescript mocha ts-node @types/node@18 npm -g
46
+ npm install
47
+ npm run test
48
+ build:
49
+ # The type of runner that the job will run on
50
+ strategy:
51
+ matrix:
52
+ node-version: [ 16.x, 18.x]
53
+ os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
54
+ runs-on: ${{ matrix.os }}
55
+ # Steps represent a sequence of tasks that will be executed as part of the job
56
+ steps:
57
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
58
+ - name: checkout
59
+ uses: actions/checkout@v3
60
+
61
+ - name: Use Node.js ${{ matrix.node-version }}
62
+ uses: actions/setup-node@v3
63
+ with:
64
+ node-version: ${{ matrix.node-version }}
65
+
66
+ - name: openssl
67
+ run: openssl version
68
+ - name: nodejs
69
+ run: node --version
70
+
71
+ # Runs a set of commands using the runners shell
72
+ - name: build
73
+ run: |
74
+ npm install npm@9 -g
75
+ npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} -g
76
+ npm install
77
+ npm run test
78
+ build-legacy:
79
+ # The type of runner that the job will run on
80
+ strategy:
81
+ matrix:
82
+ node-version: [12.x, 14.x]
83
+ os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
84
+ runs-on: ${{ matrix.os }}
85
+ # Steps represent a sequence of tasks that will be executed as part of the job
86
+ steps:
87
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
88
+ - name: checkout
89
+ uses: actions/checkout@v3
90
+
91
+ - name: Use Node.js ${{ matrix.node-version }}
92
+ uses: actions/setup-node@v3
93
+ with:
94
+ node-version: ${{ matrix.node-version }}
95
+
96
+ - name: openssl
97
+ run: openssl version
98
+ - name: nodejs
99
+ run: node --version
100
+
101
+ # Runs a set of commands using the runners shell
102
+ - name: build
103
+ run: |
104
+ npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} npm@8 -g
105
+ npm install
106
+ npm run test
package/.prettierrc.js CHANGED
@@ -1,7 +1,7 @@
1
- module.exports = {
2
- semi: true,
3
- trailingComma: "es5",
4
- singleQuote: false,
5
- printWidth: 132,
6
- tabWidth: 4,
1
+ module.exports = {
2
+ semi: true,
3
+ trailingComma: "es5",
4
+ singleQuote: false,
5
+ printWidth: 132,
6
+ tabWidth: 4,
7
7
  };
package/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Etienne Rossignon 2015-2022
4
- Copyright (c) Sterfive.com 2022
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
-
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Etienne Rossignon 2015-2022
4
+ Copyright (c) Sterfive.com 2022
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
- # node-opcua-crypto
2
-
3
- [![Build Status](https://travis-ci.org/node-opcua/node-opcua-crypto.png?branch=master)](https://travis-ci.org/node-opcua/node-opcua-crypto)
4
- [![Code Climate](https://codeclimate.com/github/node-opcua/node-opcua-crypto/badges/gpa.svg)](https://codeclimate.com/github/node-opcua/node-opcua-crypto)
5
- [![Test Coverage](https://codeclimate.com/github/node-opcua/node-opcua-crypto/badges/coverage.svg)](https://codeclimate.com/github/node-opcua/node-opcua-crypto/coverage)
6
- [![Coverage Status](https://coveralls.io/repos/github/node-opcua/node-opcua-crypto/badge.svg?branch=master)](https://coveralls.io/github/node-opcua/node-opcua-crypto?branch=master)
7
-
8
- [![install size](https://packagephobia.com/badge?p=node-opcua-crypto)](https://packagephobia.com/result?p=node-opcua-crypto)
9
-
10
- [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto.svg?type=shield)](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto?ref=badge_shield)
11
-
12
- https://app.fossa.com/reports/489947c3-2e83-48e5-8351-192f553ded57
13
-
14
- // https://linuxctl.com/2017/02/x509-certificate-manual-signature-verification/
1
+ # node-opcua-crypto
2
+
3
+ [![Build Status](https://travis-ci.org/node-opcua/node-opcua-crypto.png?branch=master)](https://travis-ci.org/node-opcua/node-opcua-crypto)
4
+ [![Code Climate](https://codeclimate.com/github/node-opcua/node-opcua-crypto/badges/gpa.svg)](https://codeclimate.com/github/node-opcua/node-opcua-crypto)
5
+ [![Test Coverage](https://codeclimate.com/github/node-opcua/node-opcua-crypto/badges/coverage.svg)](https://codeclimate.com/github/node-opcua/node-opcua-crypto/coverage)
6
+ [![Coverage Status](https://coveralls.io/repos/github/node-opcua/node-opcua-crypto/badge.svg?branch=master)](https://coveralls.io/github/node-opcua/node-opcua-crypto?branch=master)
7
+
8
+ [![install size](https://packagephobia.com/badge?p=node-opcua-crypto)](https://packagephobia.com/result?p=node-opcua-crypto)
9
+
10
+ [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto.svg?type=shield)](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto?ref=badge_shield)
11
+
12
+ https://app.fossa.com/reports/489947c3-2e83-48e5-8351-192f553ded57
13
+
14
+ // https://linuxctl.com/2017/02/x509-certificate-manual-signature-verification/
@@ -1,73 +1,73 @@
1
- /// <reference types="node" />
2
- export declare enum TagType {
3
- BOOLEAN = 1,
4
- INTEGER = 2,
5
- BIT_STRING = 3,
6
- OCTET_STRING = 4,
7
- NULL = 5,
8
- OBJECT_IDENTIFIER = 6,
9
- UTF8String = 12,
10
- NumericString = 18,
11
- PrintableString = 19,
12
- TeletexString = 20,
13
- IA5String = 22,
14
- UTCTime = 23,
15
- GeneralizedTime = 24,
16
- GraphicString = 25,
17
- VisibleString = 26,
18
- GeneralString = 27,
19
- UniversalString = 28,
20
- BMPString = 30,
21
- SEQUENCE = 48,
22
- SET = 49,
23
- A3 = 163
24
- }
25
- export interface BlockInfo {
26
- tag: TagType | number;
27
- position: number;
28
- length: number;
29
- }
30
- export declare function readTag(buf: Buffer, pos: number): BlockInfo;
31
- export declare function _readStruct(buf: Buffer, blockInfo: BlockInfo): BlockInfo[];
32
- export declare function parseBitString(buffer: Buffer, start: number, end: number, maxLength: number): string;
33
- export interface BitString {
34
- lengthInBits: number;
35
- lengthInBytes: number;
36
- data: Buffer;
37
- debug?: any;
38
- }
39
- export declare function _readBitString(buffer: Buffer, block: BlockInfo): BitString;
40
- export declare function formatBuffer2DigitHexWithColum(buffer: Buffer): string;
41
- export declare function _readOctetString(buffer: Buffer, block: BlockInfo): Buffer;
42
- export declare function _getBlock(buffer: Buffer, block: BlockInfo): Buffer;
43
- export interface AlgorithmIdentifier {
44
- identifier: string;
45
- }
46
- export declare function _readIntegerAsByteString(buffer: Buffer, block: BlockInfo): Buffer;
47
- export declare function _readListOfInteger(buffer: Buffer): Buffer[];
48
- export declare function _readObjectIdentifier(buffer: Buffer, block: BlockInfo): {
49
- oid: string;
50
- name: string;
51
- };
52
- export declare function _readAlgorithmIdentifier(buffer: Buffer, block: BlockInfo): AlgorithmIdentifier;
53
- export declare function _readECCAlgorithmIdentifier(buffer: Buffer, block: BlockInfo): AlgorithmIdentifier;
54
- export type SignatureValue = string;
55
- export declare function _readSignatureValueBin(buffer: Buffer, block: BlockInfo): Buffer;
56
- export declare function _readSignatureValue(buffer: Buffer, block: BlockInfo): SignatureValue;
57
- export declare function _readLongIntegerValue(buffer: Buffer, block: BlockInfo): Buffer;
58
- export declare function _readIntegerValue(buffer: Buffer, block: BlockInfo): number;
59
- export declare function _readBooleanValue(buffer: Buffer, block: BlockInfo): boolean;
60
- export declare function _readVersionValue(buffer: Buffer, block: BlockInfo): number;
61
- export declare function _readValue(buffer: Buffer, block: BlockInfo): any;
62
- export interface DirectoryName {
63
- stateOrProvinceName?: string;
64
- localityName?: string;
65
- organizationName?: string;
66
- organizationUnitName?: string;
67
- commonName?: string;
68
- countryName?: string;
69
- }
70
- export declare function compactDirectoryName(d: DirectoryName): string;
71
- export declare function _readDirectoryName(buffer: Buffer, block: BlockInfo): DirectoryName;
72
- export declare function _findBlockAtIndex(blocks: BlockInfo[], index: number): BlockInfo | null;
73
- export declare function _readTime(buffer: Buffer, block: BlockInfo): any;
1
+ /// <reference types="node" />
2
+ export declare enum TagType {
3
+ BOOLEAN = 1,
4
+ INTEGER = 2,
5
+ BIT_STRING = 3,
6
+ OCTET_STRING = 4,
7
+ NULL = 5,
8
+ OBJECT_IDENTIFIER = 6,
9
+ UTF8String = 12,
10
+ NumericString = 18,
11
+ PrintableString = 19,
12
+ TeletexString = 20,
13
+ IA5String = 22,
14
+ UTCTime = 23,
15
+ GeneralizedTime = 24,
16
+ GraphicString = 25,
17
+ VisibleString = 26,
18
+ GeneralString = 27,
19
+ UniversalString = 28,
20
+ BMPString = 30,
21
+ SEQUENCE = 48,
22
+ SET = 49,
23
+ A3 = 163
24
+ }
25
+ export interface BlockInfo {
26
+ tag: TagType | number;
27
+ position: number;
28
+ length: number;
29
+ }
30
+ export declare function readTag(buf: Buffer, pos: number): BlockInfo;
31
+ export declare function _readStruct(buf: Buffer, blockInfo: BlockInfo): BlockInfo[];
32
+ export declare function parseBitString(buffer: Buffer, start: number, end: number, maxLength: number): string;
33
+ export interface BitString {
34
+ lengthInBits: number;
35
+ lengthInBytes: number;
36
+ data: Buffer;
37
+ debug?: any;
38
+ }
39
+ export declare function _readBitString(buffer: Buffer, block: BlockInfo): BitString;
40
+ export declare function formatBuffer2DigitHexWithColum(buffer: Buffer): string;
41
+ export declare function _readOctetString(buffer: Buffer, block: BlockInfo): Buffer;
42
+ export declare function _getBlock(buffer: Buffer, block: BlockInfo): Buffer;
43
+ export interface AlgorithmIdentifier {
44
+ identifier: string;
45
+ }
46
+ export declare function _readIntegerAsByteString(buffer: Buffer, block: BlockInfo): Buffer;
47
+ export declare function _readListOfInteger(buffer: Buffer): Buffer[];
48
+ export declare function _readObjectIdentifier(buffer: Buffer, block: BlockInfo): {
49
+ oid: string;
50
+ name: string;
51
+ };
52
+ export declare function _readAlgorithmIdentifier(buffer: Buffer, block: BlockInfo): AlgorithmIdentifier;
53
+ export declare function _readECCAlgorithmIdentifier(buffer: Buffer, block: BlockInfo): AlgorithmIdentifier;
54
+ export type SignatureValue = string;
55
+ export declare function _readSignatureValueBin(buffer: Buffer, block: BlockInfo): Buffer;
56
+ export declare function _readSignatureValue(buffer: Buffer, block: BlockInfo): SignatureValue;
57
+ export declare function _readLongIntegerValue(buffer: Buffer, block: BlockInfo): Buffer;
58
+ export declare function _readIntegerValue(buffer: Buffer, block: BlockInfo): number;
59
+ export declare function _readBooleanValue(buffer: Buffer, block: BlockInfo): boolean;
60
+ export declare function _readVersionValue(buffer: Buffer, block: BlockInfo): number;
61
+ export declare function _readValue(buffer: Buffer, block: BlockInfo): any;
62
+ export interface DirectoryName {
63
+ stateOrProvinceName?: string;
64
+ localityName?: string;
65
+ organizationName?: string;
66
+ organizationUnitName?: string;
67
+ commonName?: string;
68
+ countryName?: string;
69
+ }
70
+ export declare function compactDirectoryName(d: DirectoryName): string;
71
+ export declare function _readDirectoryName(buffer: Buffer, block: BlockInfo): DirectoryName;
72
+ export declare function _findBlockAtIndex(blocks: BlockInfo[], index: number): BlockInfo | null;
73
+ export declare function _readTime(buffer: Buffer, block: BlockInfo): any;