sm-crypto-wasm 0.3.1 → 0.7.1
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/README.md +62 -834
- package/dist/asn1/decode.d.ts +165 -0
- package/dist/asn1/decode.js +457 -0
- package/dist/asn1/encode.d.ts +169 -0
- package/dist/asn1/encode.js +414 -0
- package/dist/asn1/index.d.ts +17 -0
- package/dist/asn1/index.js +17 -0
- package/dist/asn1/oid.d.ts +40 -0
- package/dist/asn1/oid.js +136 -0
- package/dist/asn1/time.d.ts +71 -0
- package/dist/asn1/time.js +165 -0
- package/dist/asn1/types.d.ts +160 -0
- package/dist/asn1/types.js +112 -0
- package/dist/cms/errors.d.ts +23 -0
- package/dist/cms/errors.js +17 -0
- package/dist/cms/index.d.ts +18 -0
- package/dist/cms/index.js +15 -0
- package/dist/cms/oids.d.ts +47 -0
- package/dist/cms/oids.js +47 -0
- package/dist/cms/parse.d.ts +217 -0
- package/dist/cms/parse.js +420 -0
- package/dist/cms/sign.d.ts +113 -0
- package/dist/cms/sign.js +194 -0
- package/dist/cms/verify.d.ts +117 -0
- package/dist/cms/verify.js +222 -0
- package/dist/common/hybrid.d.ts +25 -0
- package/dist/common/hybrid.js +25 -0
- package/dist/common/sealed.d.ts +119 -15
- package/dist/common/sealed.js +67 -9
- package/dist/esbuild-plugin.d.ts +74 -5
- package/dist/esbuild-plugin.js +69 -4
- package/dist/index.d.ts +22 -0
- package/dist/index.js +25 -0
- package/dist/pem/asn1.d.ts +19 -65
- package/dist/pem/asn1.js +19 -288
- package/dist/pem/index.d.ts +2 -0
- package/dist/pem/index.js +2 -0
- package/dist/pem/pkcs8.d.ts +64 -8
- package/dist/pem/pkcs8.js +75 -7
- package/dist/pem/sm2.d.ts +90 -2
- package/dist/pem/sm2.js +204 -15
- package/dist/pem/sm9.d.ts +42 -2
- package/dist/pem/sm9.js +42 -2
- package/dist/runtime/base64.core.d.ts +25 -1
- package/dist/runtime/base64.core.js +31 -1
- package/dist/runtime/convert.d.ts +70 -7
- package/dist/runtime/convert.js +129 -9
- package/dist/runtime/errors.d.ts +64 -8
- package/dist/runtime/errors.js +64 -8
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +5 -0
- package/dist/runtime/loadWasm.browser.d.ts +33 -0
- package/dist/runtime/loadWasm.browser.js +46 -0
- package/dist/runtime/loadWasm.core.d.ts +59 -3
- package/dist/runtime/loadWasm.core.js +53 -3
- package/dist/runtime/loadWasm.d.ts +44 -0
- package/dist/runtime/loadWasm.js +79 -4
- package/dist/runtime/random.browser.d.ts +24 -0
- package/dist/runtime/random.browser.js +31 -1
- package/dist/runtime/random.core.d.ts +21 -0
- package/dist/runtime/random.core.js +27 -0
- package/dist/runtime/random.d.ts +28 -0
- package/dist/runtime/random.js +40 -1
- package/dist/sm2/exchange.d.ts +132 -16
- package/dist/sm2/exchange.js +120 -9
- package/dist/sm2/hybrid.d.ts +65 -3
- package/dist/sm2/hybrid.js +53 -1
- package/dist/sm2/index.d.ts +324 -16
- package/dist/sm2/index.js +530 -19
- package/dist/sm2/kem.d.ts +62 -5
- package/dist/sm2/kem.js +37 -2
- package/dist/sm2/keyInput.d.ts +36 -3
- package/dist/sm2/keyInput.js +36 -3
- package/dist/sm2/sm2.wasm +0 -0
- package/dist/sm3/index.d.ts +30 -0
- package/dist/sm3/index.js +55 -1
- package/dist/sm4/index.d.ts +125 -17
- package/dist/sm4/index.js +201 -14
- package/dist/sm9/core.d.ts +58 -8
- package/dist/sm9/core.js +36 -5
- package/dist/sm9/hybrid.d.ts +66 -3
- package/dist/sm9/hybrid.js +46 -1
- package/dist/sm9/index.d.ts +265 -19
- package/dist/sm9/index.js +175 -5
- package/dist/sm9/input.d.ts +37 -2
- package/dist/sm9/input.js +50 -1
- package/dist/sm9/kem.d.ts +57 -4
- package/dist/sm9/kem.js +47 -1
- package/dist/webcrypto/algorithms.d.ts +88 -0
- package/dist/webcrypto/algorithms.js +168 -0
- package/dist/webcrypto/cryptoKey.d.ts +130 -0
- package/dist/webcrypto/cryptoKey.js +167 -0
- package/dist/webcrypto/errors.d.ts +43 -0
- package/dist/webcrypto/errors.js +69 -0
- package/dist/webcrypto/index.d.ts +24 -0
- package/dist/webcrypto/index.js +21 -0
- package/dist/webcrypto/subtle.d.ts +118 -0
- package/dist/webcrypto/subtle.js +426 -0
- package/dist/x509/encode.d.ts +129 -0
- package/dist/x509/encode.js +248 -0
- package/dist/x509/errors.d.ts +29 -0
- package/dist/x509/errors.js +29 -0
- package/dist/x509/extensions.d.ts +66 -0
- package/dist/x509/extensions.js +273 -0
- package/dist/x509/index.d.ts +21 -0
- package/dist/x509/index.js +30 -0
- package/dist/x509/ip.d.ts +21 -0
- package/dist/x509/ip.js +122 -0
- package/dist/x509/issue.d.ts +87 -0
- package/dist/x509/issue.js +521 -0
- package/dist/x509/oids.d.ts +74 -0
- package/dist/x509/oids.js +103 -0
- package/dist/x509/parse.d.ts +45 -0
- package/dist/x509/parse.js +550 -0
- package/dist/x509/sha1.d.ts +20 -0
- package/dist/x509/sha1.js +89 -0
- package/dist/x509/sha256.d.ts +20 -0
- package/dist/x509/sha256.js +114 -0
- package/dist/x509/sig.d.ts +35 -0
- package/dist/x509/sig.js +104 -0
- package/dist/x509/types.d.ts +490 -0
- package/dist/x509/types.js +13 -0
- package/dist/x509/verify.d.ts +91 -0
- package/dist/x509/verify.js +105 -0
- package/dist/zuc/index.d.ts +128 -10
- package/dist/zuc/index.js +136 -7
- package/package.json +57 -28
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS SignedData 子模块(`sm-crypto-wasm/cms`)。
|
|
3
|
+
*
|
|
4
|
+
* 只做签名/验签,不建立信任链;证书有效期/用途/链校验由调用方负责。
|
|
5
|
+
*
|
|
6
|
+
* CMS SignedData submodule (`sm-crypto-wasm/cms`).
|
|
7
|
+
*
|
|
8
|
+
* Signing/verification only, no trust chain building: certificate validity, key usage
|
|
9
|
+
* and chain validation are the caller's responsibility.
|
|
10
|
+
*/
|
|
11
|
+
export { CmsError, type CmsVerifyErrorCode } from './errors.js';
|
|
12
|
+
export * from './oids.js';
|
|
13
|
+
export type { CmsAttribute, CmsSignerIdentifier, CmsSignerInfo, ParsedSignedData, } from './parse.js';
|
|
14
|
+
export { parseSignedData } from './parse.js';
|
|
15
|
+
export type { SignDataOptions, SignDataResult } from './sign.js';
|
|
16
|
+
export { signData } from './sign.js';
|
|
17
|
+
export type { VerifySignedDataOptions, VerifySignedDataResult, VerifySignerResult, } from './verify.js';
|
|
18
|
+
export { signerIdentifierHex, verifySignedData } from './verify.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS SignedData 子模块(`sm-crypto-wasm/cms`)。
|
|
3
|
+
*
|
|
4
|
+
* 只做签名/验签,不建立信任链;证书有效期/用途/链校验由调用方负责。
|
|
5
|
+
*
|
|
6
|
+
* CMS SignedData submodule (`sm-crypto-wasm/cms`).
|
|
7
|
+
*
|
|
8
|
+
* Signing/verification only, no trust chain building: certificate validity, key usage
|
|
9
|
+
* and chain validation are the caller's responsibility.
|
|
10
|
+
*/
|
|
11
|
+
export { CmsError } from './errors.js';
|
|
12
|
+
export * from './oids.js';
|
|
13
|
+
export { parseSignedData } from './parse.js';
|
|
14
|
+
export { signData } from './sign.js';
|
|
15
|
+
export { signerIdentifierHex, verifySignedData } from './verify.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS oid 常量。
|
|
3
|
+
*
|
|
4
|
+
* CMS OID constants.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* id-data(1.2.840.113549.1.7.1)。
|
|
8
|
+
*
|
|
9
|
+
* id-data (1.2.840.113549.1.7.1).
|
|
10
|
+
*/
|
|
11
|
+
export declare const OID_CMS_DATA = "1.2.840.113549.1.7.1";
|
|
12
|
+
/**
|
|
13
|
+
* id-signedData(1.2.840.113549.1.7.2)。
|
|
14
|
+
*
|
|
15
|
+
* id-signedData (1.2.840.113549.1.7.2).
|
|
16
|
+
*/
|
|
17
|
+
export declare const OID_CMS_SIGNED_DATA = "1.2.840.113549.1.7.2";
|
|
18
|
+
/**
|
|
19
|
+
* contentType 签名属性(1.2.840.113549.1.9.3)。
|
|
20
|
+
*
|
|
21
|
+
* The contentType signed attribute (1.2.840.113549.1.9.3).
|
|
22
|
+
*/
|
|
23
|
+
export declare const OID_CMS_CONTENT_TYPE = "1.2.840.113549.1.9.3";
|
|
24
|
+
/**
|
|
25
|
+
* messageDigest 签名属性(1.2.840.113549.1.9.4)。
|
|
26
|
+
*
|
|
27
|
+
* The messageDigest signed attribute (1.2.840.113549.1.9.4).
|
|
28
|
+
*/
|
|
29
|
+
export declare const OID_CMS_MESSAGE_DIGEST = "1.2.840.113549.1.9.4";
|
|
30
|
+
/**
|
|
31
|
+
* signingTime 签名属性(1.2.840.113549.1.9.5)。
|
|
32
|
+
*
|
|
33
|
+
* The signingTime signed attribute (1.2.840.113549.1.9.5).
|
|
34
|
+
*/
|
|
35
|
+
export declare const OID_CMS_SIGNING_TIME = "1.2.840.113549.1.9.5";
|
|
36
|
+
/**
|
|
37
|
+
* SM3 摘要算法(1.2.156.10197.1.401)。
|
|
38
|
+
*
|
|
39
|
+
* The SM3 digest algorithm (1.2.156.10197.1.401).
|
|
40
|
+
*/
|
|
41
|
+
export declare const OID_SM3 = "1.2.156.10197.1.401";
|
|
42
|
+
/**
|
|
43
|
+
* SM3withSM2(1.2.156.10197.1.501)。
|
|
44
|
+
*
|
|
45
|
+
* SM3withSM2 (1.2.156.10197.1.501).
|
|
46
|
+
*/
|
|
47
|
+
export declare const OID_SM3_WITH_SM2 = "1.2.156.10197.1.501";
|
package/dist/cms/oids.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS oid 常量。
|
|
3
|
+
*
|
|
4
|
+
* CMS OID constants.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* id-data(1.2.840.113549.1.7.1)。
|
|
8
|
+
*
|
|
9
|
+
* id-data (1.2.840.113549.1.7.1).
|
|
10
|
+
*/
|
|
11
|
+
export const OID_CMS_DATA = '1.2.840.113549.1.7.1';
|
|
12
|
+
/**
|
|
13
|
+
* id-signedData(1.2.840.113549.1.7.2)。
|
|
14
|
+
*
|
|
15
|
+
* id-signedData (1.2.840.113549.1.7.2).
|
|
16
|
+
*/
|
|
17
|
+
export const OID_CMS_SIGNED_DATA = '1.2.840.113549.1.7.2';
|
|
18
|
+
/**
|
|
19
|
+
* contentType 签名属性(1.2.840.113549.1.9.3)。
|
|
20
|
+
*
|
|
21
|
+
* The contentType signed attribute (1.2.840.113549.1.9.3).
|
|
22
|
+
*/
|
|
23
|
+
export const OID_CMS_CONTENT_TYPE = '1.2.840.113549.1.9.3';
|
|
24
|
+
/**
|
|
25
|
+
* messageDigest 签名属性(1.2.840.113549.1.9.4)。
|
|
26
|
+
*
|
|
27
|
+
* The messageDigest signed attribute (1.2.840.113549.1.9.4).
|
|
28
|
+
*/
|
|
29
|
+
export const OID_CMS_MESSAGE_DIGEST = '1.2.840.113549.1.9.4';
|
|
30
|
+
/**
|
|
31
|
+
* signingTime 签名属性(1.2.840.113549.1.9.5)。
|
|
32
|
+
*
|
|
33
|
+
* The signingTime signed attribute (1.2.840.113549.1.9.5).
|
|
34
|
+
*/
|
|
35
|
+
export const OID_CMS_SIGNING_TIME = '1.2.840.113549.1.9.5';
|
|
36
|
+
/**
|
|
37
|
+
* SM3 摘要算法(1.2.156.10197.1.401)。
|
|
38
|
+
*
|
|
39
|
+
* The SM3 digest algorithm (1.2.156.10197.1.401).
|
|
40
|
+
*/
|
|
41
|
+
export const OID_SM3 = '1.2.156.10197.1.401';
|
|
42
|
+
/**
|
|
43
|
+
* SM3withSM2(1.2.156.10197.1.501)。
|
|
44
|
+
*
|
|
45
|
+
* SM3withSM2 (1.2.156.10197.1.501).
|
|
46
|
+
*/
|
|
47
|
+
export const OID_SM3_WITH_SM2 = '1.2.156.10197.1.501';
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS SignedData 解析(只读)。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(红线 #1):
|
|
5
|
+
* `signedAttrs` 的签名输入是**原始 DER 字节**(SET OF Attribute),而不是
|
|
6
|
+
* 解析后重新编码的结果。这里保留:
|
|
7
|
+
* - `raw`:把 `[0] IMPLICIT` 的首字节(0xA0)换成 SET(0x31)后的字节;
|
|
8
|
+
* - 对 BER indefinite-length,先编码为 definite-length 再替换首字节。
|
|
9
|
+
* 除首字节外不做任何重编码,避免 SET 顺序/长度编码差异破坏合法签名。
|
|
10
|
+
*
|
|
11
|
+
* BER 只在 CMS 路径启用;证书本身仍按 DER 严格解析。
|
|
12
|
+
*
|
|
13
|
+
* CMS SignedData parsing (read-only).
|
|
14
|
+
*
|
|
15
|
+
* Key point (red line #1): the signing input of `signedAttrs` is the **original DER
|
|
16
|
+
* bytes** (a SET OF Attribute), not a re-encoding of the parsed form. This module keeps:
|
|
17
|
+
* - `raw`: the bytes obtained by replacing the leading byte of `[0] IMPLICIT` (0xA0)
|
|
18
|
+
* with the SET tag (0x31);
|
|
19
|
+
* - for BER indefinite-length, the value is first encoded as definite-length and then
|
|
20
|
+
* the leading byte is replaced.
|
|
21
|
+
* Nothing but the leading byte is re-encoded, so SET ordering or length-encoding
|
|
22
|
+
* differences can never break a valid signature.
|
|
23
|
+
*
|
|
24
|
+
* BER is enabled on the CMS path only; certificates themselves are still parsed as
|
|
25
|
+
* strict DER.
|
|
26
|
+
*/
|
|
27
|
+
import { type Asn1Node } from '../asn1/index.js';
|
|
28
|
+
import type { Certificate } from '../x509/types.js';
|
|
29
|
+
/**
|
|
30
|
+
* 一个签名属性(Attribute ::= SEQUENCE { attrType, attrValues SET OF }).
|
|
31
|
+
*
|
|
32
|
+
* A single signed attribute (`Attribute ::= SEQUENCE { attrType, attrValues SET OF }`).
|
|
33
|
+
*/
|
|
34
|
+
export interface CmsAttribute {
|
|
35
|
+
/**
|
|
36
|
+
* 属性类型 OID。
|
|
37
|
+
*
|
|
38
|
+
* The attribute type OID.
|
|
39
|
+
*/
|
|
40
|
+
readonly oid: string;
|
|
41
|
+
/**
|
|
42
|
+
* AttributeValue 节点(原始视图)。
|
|
43
|
+
*
|
|
44
|
+
* AttributeValue nodes (raw views).
|
|
45
|
+
*/
|
|
46
|
+
readonly values: readonly Asn1Node[];
|
|
47
|
+
/**
|
|
48
|
+
* 整个 Attribute 的原始 DER。
|
|
49
|
+
*
|
|
50
|
+
* Raw DER of the whole Attribute.
|
|
51
|
+
*/
|
|
52
|
+
readonly raw: Uint8Array;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 签名者标识。
|
|
56
|
+
*
|
|
57
|
+
* The signer identifier.
|
|
58
|
+
*/
|
|
59
|
+
export type CmsSignerIdentifier = {
|
|
60
|
+
readonly type: 'issuerAndSerialNumber';
|
|
61
|
+
/**
|
|
62
|
+
* 签发者 Name 的原始 DER,用于按字节匹配证书。
|
|
63
|
+
*
|
|
64
|
+
* Raw DER of the issuer Name, used to match certificates byte for byte.
|
|
65
|
+
*/
|
|
66
|
+
readonly issuerRaw: Uint8Array;
|
|
67
|
+
/**
|
|
68
|
+
* 证书序列号(ASN.1 INTEGER,无符号大整数)。
|
|
69
|
+
*
|
|
70
|
+
* The certificate serial number (an ASN.1 INTEGER held as a bigint).
|
|
71
|
+
*/
|
|
72
|
+
readonly serialNumber: bigint;
|
|
73
|
+
} | {
|
|
74
|
+
readonly type: 'subjectKeyIdentifier';
|
|
75
|
+
/**
|
|
76
|
+
* `subjectKeyIdentifier` 的原始字节。
|
|
77
|
+
*
|
|
78
|
+
* Raw bytes of the `subjectKeyIdentifier` extension value.
|
|
79
|
+
*/
|
|
80
|
+
readonly keyIdentifier: Uint8Array;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 解析后的 SignerInfo。
|
|
84
|
+
*
|
|
85
|
+
* A parsed SignerInfo.
|
|
86
|
+
*/
|
|
87
|
+
export interface CmsSignerInfo {
|
|
88
|
+
/**
|
|
89
|
+
* SignerInfo 版本号(原样解析,不做校验)。
|
|
90
|
+
*
|
|
91
|
+
* The SignerInfo version, taken as parsed and not validated.
|
|
92
|
+
*/
|
|
93
|
+
readonly version: number;
|
|
94
|
+
/**
|
|
95
|
+
* 签名者标识(`issuerAndSerialNumber` 或 `subjectKeyIdentifier`)。
|
|
96
|
+
*
|
|
97
|
+
* The signer identifier (`issuerAndSerialNumber` or `subjectKeyIdentifier`).
|
|
98
|
+
*/
|
|
99
|
+
readonly sid: CmsSignerIdentifier;
|
|
100
|
+
/**
|
|
101
|
+
* 摘要算法 OID;验签层只接受 SM3(`OID_SM3`)。
|
|
102
|
+
*
|
|
103
|
+
* Digest algorithm OID; the verification layer only accepts SM3 (`OID_SM3`).
|
|
104
|
+
*/
|
|
105
|
+
readonly digestAlgorithm: string;
|
|
106
|
+
/**
|
|
107
|
+
* signedAttrs 的签名输入字节(SET tag 0x31)。
|
|
108
|
+
* 没有 signedAttrs 时为 `undefined`(直接签内容)。
|
|
109
|
+
*
|
|
110
|
+
* The signing-input bytes of signedAttrs (SET tag 0x31).
|
|
111
|
+
* `undefined` when there are no signedAttrs (the content is signed directly).
|
|
112
|
+
*/
|
|
113
|
+
readonly signedAttrs?: {
|
|
114
|
+
readonly raw: Uint8Array;
|
|
115
|
+
readonly attributes: readonly CmsAttribute[];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 签名算法 OID;验签层只接受 SM3withSM2(`OID_SM3_WITH_SM2`)。
|
|
119
|
+
*
|
|
120
|
+
* Signature algorithm OID; the verification layer only accepts SM3withSM2
|
|
121
|
+
* (`OID_SM3_WITH_SM2`).
|
|
122
|
+
*/
|
|
123
|
+
readonly signatureAlgorithm: string;
|
|
124
|
+
/**
|
|
125
|
+
* 签名字节(DER 的 `SEQUENCE { r, s }`,验签前转成裸 `r || s`)。
|
|
126
|
+
*
|
|
127
|
+
* Signature bytes (a DER `SEQUENCE { r, s }`, converted to raw `r || s` before
|
|
128
|
+
* verification).
|
|
129
|
+
*/
|
|
130
|
+
readonly signature: Uint8Array;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 解析后的 SignedData。
|
|
134
|
+
*
|
|
135
|
+
* A parsed SignedData.
|
|
136
|
+
*/
|
|
137
|
+
export interface ParsedSignedData {
|
|
138
|
+
/**
|
|
139
|
+
* SignedData 版本号(原样解析,不做校验)。
|
|
140
|
+
*
|
|
141
|
+
* The SignedData version, taken as parsed and not validated.
|
|
142
|
+
*/
|
|
143
|
+
readonly version: number;
|
|
144
|
+
/**
|
|
145
|
+
* `digestAlgorithms` 里的算法 OID 列表。
|
|
146
|
+
*
|
|
147
|
+
* The algorithm OIDs listed in `digestAlgorithms`.
|
|
148
|
+
*/
|
|
149
|
+
readonly digestAlgorithms: readonly string[];
|
|
150
|
+
/**
|
|
151
|
+
* 内容类型 OID(本仓库的签名路径固定输出 id-data)。
|
|
152
|
+
*
|
|
153
|
+
* The content type OID (the signing path here always emits id-data).
|
|
154
|
+
*/
|
|
155
|
+
readonly eContentType: string;
|
|
156
|
+
/**
|
|
157
|
+
* 内嵌内容;detached 时为 `undefined`。
|
|
158
|
+
*
|
|
159
|
+
* The embedded content; `undefined` for detached signatures.
|
|
160
|
+
*/
|
|
161
|
+
readonly eContent?: Uint8Array;
|
|
162
|
+
/**
|
|
163
|
+
* 解析成功的 X.509 证书(无法解析的 CertificateChoices 已跳过)。
|
|
164
|
+
*
|
|
165
|
+
* Successfully parsed X.509 certificates (unparseable CertificateChoices skipped).
|
|
166
|
+
*/
|
|
167
|
+
readonly certificates: readonly Certificate[];
|
|
168
|
+
/**
|
|
169
|
+
* SignerInfo 列表,顺序与 CMS 中一致。
|
|
170
|
+
*
|
|
171
|
+
* The SignerInfo entries, in the order they appear in the CMS.
|
|
172
|
+
*/
|
|
173
|
+
readonly signerInfos: readonly CmsSignerInfo[];
|
|
174
|
+
/**
|
|
175
|
+
* 整个 ContentInfo 的原始 DER。
|
|
176
|
+
*
|
|
177
|
+
* Raw DER of the whole ContentInfo.
|
|
178
|
+
*/
|
|
179
|
+
readonly raw: Uint8Array;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 解析 CMS ContentInfo(仅接受 SignedData)。
|
|
183
|
+
*
|
|
184
|
+
* @param input PEM(`CMS` / `PKCS7`)、base64、hex 或 DER/BER 字节。
|
|
185
|
+
* @throws CmsError 结构非法、不是 SignedData、或尾部有多余字节。
|
|
186
|
+
*
|
|
187
|
+
* Parses a CMS ContentInfo (SignedData only).
|
|
188
|
+
*
|
|
189
|
+
* @param input PEM (`CMS` / `PKCS7`), base64, hex, or DER/BER bytes.
|
|
190
|
+
* @throws CmsError When the structure is invalid, is not SignedData, or has trailing
|
|
191
|
+
* bytes.
|
|
192
|
+
*/
|
|
193
|
+
export declare function parseSignedData(input: string | Uint8Array): ParsedSignedData;
|
|
194
|
+
/**
|
|
195
|
+
* 读取签名属性中的时间值(供验签层使用)。
|
|
196
|
+
*
|
|
197
|
+
* Reads the time value of a signed attribute (used by the verification layer).
|
|
198
|
+
*/
|
|
199
|
+
export declare function attributeTime(attribute: CmsAttribute | undefined): Date | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* 读取签名属性中的 OCTET STRING 值(messageDigest)。
|
|
202
|
+
*
|
|
203
|
+
* Reads the OCTET STRING value of a signed attribute (messageDigest).
|
|
204
|
+
*/
|
|
205
|
+
export declare function attributeOctets(attribute: CmsAttribute | undefined): Uint8Array | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* 读取签名属性中的 OID 值(contentType)。
|
|
208
|
+
*
|
|
209
|
+
* Reads the OID value of a signed attribute (contentType).
|
|
210
|
+
*/
|
|
211
|
+
export declare function attributeOid(attribute: CmsAttribute | undefined): string | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* 十六进制便捷函数(供错误信息/调试使用)。
|
|
214
|
+
*
|
|
215
|
+
* Hex convenience helper, for error messages and debugging.
|
|
216
|
+
*/
|
|
217
|
+
export declare function cmsHex(bytes: Uint8Array): string;
|