@sswroom/sswr 1.5.5 → 1.6.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/certutil.d.ts ADDED
@@ -0,0 +1,376 @@
1
+ import * as data from "./data";
2
+
3
+ export enum ASN1ItemType
4
+ {
5
+ UNKNOWN,
6
+ BOOLEAN,
7
+ INTEGER,
8
+ BIT_STRING,
9
+ OCTET_STRING,
10
+ NULL,
11
+ OID,
12
+ ENUMERATED,
13
+ UTF8STRING,
14
+ NUMERICSTRING,
15
+ PRINTABLESTRING,
16
+ T61STRING,
17
+ VIDEOTEXSTRING,
18
+ IA5STRING,
19
+ UTCTIME,
20
+ GENERALIZEDTIME,
21
+ UNIVERSALSTRING,
22
+ BMPSTRING,
23
+ SEQUENCE,
24
+ SET,
25
+ CHOICE_0,
26
+ CHOICE_1,
27
+ CHOICE_2,
28
+ CHOICE_3,
29
+ CHOICE_4,
30
+ CHOICE_5,
31
+ CHOICE_6,
32
+ CHOICE_7,
33
+ CHOICE_8,
34
+ CONTEXT_SPECIFIC_0,
35
+ CONTEXT_SPECIFIC_1,
36
+ CONTEXT_SPECIFIC_2,
37
+ CONTEXT_SPECIFIC_3,
38
+ CONTEXT_SPECIFIC_4
39
+ }
40
+
41
+ export enum RuleCond
42
+ {
43
+ Any,
44
+ TypeIsItemType,
45
+ TypeIsTime,
46
+ TypeIsString,
47
+ TypeIsOpt,
48
+ RepeatIfTypeIs,
49
+ LastOIDAndTypeIs,
50
+ AllNotMatch
51
+ };
52
+
53
+ declare class PDULenInfo
54
+ {
55
+ nextOfst: number;
56
+ pduLen: number;
57
+ }
58
+
59
+ declare class PDUValueInfo<ValType>
60
+ {
61
+ nextOfst: number;
62
+ val: ValType;
63
+ }
64
+
65
+ export class PDUInfo
66
+ {
67
+ rawOfst: number;
68
+ hdrLen: number;
69
+ contLen: number;
70
+ itemType: ASN1ItemType;
71
+
72
+ constructor(rawOfst: number, hdrLen: number, contLen: number, itemType: ASN1ItemType);
73
+ get dataOfst(): number;
74
+ get endOfst(): number;
75
+ }
76
+
77
+ export class ASN1Util
78
+ {
79
+ static pduParseLen(reader: data.ByteReader, ofst: number, endOfst: number): PDULenInfo | null;
80
+
81
+ // static const UInt8 *PDUParseSeq(const UInt8 *pdu, const UInt8 *pduEnd, UInt8 *type, const UInt8 **seqEnd);
82
+ static pduParseUInt32(reader: data.ByteReader, ofst: number, endOfst: number): PDUValueInfo<number>;
83
+ static pduParseString(reader: data.ByteReader, ofst: number, endOfst: number): PDUValueInfo<string>;
84
+ static pduParseChoice(reader: data.ByteReader, ofst: number, endOfst: number): PDUValueInfo<number>;
85
+
86
+ static pduParseUTCTimeCont(reader: data.ByteReader, startOfst: number, endOfst: number): data.Timestamp;
87
+ static pduToString(reader: data.ByteReader, startOfst: number, endOfst: number, outLines: string[], level: number, names?: ASN1Names): number;
88
+ static pduDSizeEnd(reader: data.ByteReader, startOfst: number, endOfst: number): number | null;
89
+ static pduGetItem(reader: data.ByteReader, startOfst: number, endOfst: number, path: string): PDUInfo;
90
+ static pduGetItemType(reader: data.ByteReader, startOfst: number, endOfst: number, path: string): ASN1ItemType;
91
+ static pduCountItem(reader: data.ByteReader, startOfst: number, endOfst: number, path?: string): number;
92
+ static pduIsValid(reader: data.ByteReader, startOfst: number, endOfst: number): boolean;
93
+ // static void PDUAnalyse(NotNullPtr<IO::FileAnalyse::FrameDetail> frame, Data::ByteArrayR buff, UOSInt pduOfst, UOSInt pduEndOfst, Net::ASN1Names *names);
94
+
95
+ static oidCompare(oid1: Uint8Array | number[], oid2: Uint8Array | number[]): number;
96
+ // static Bool OIDStartsWith(const UInt8 *oid1, UOSInt oid1Len, const UInt8 *oid2, UOSInt oid2Len);
97
+ static oidEqualsText(oidPDU: Uint8Array | number[], oidText: string): boolean;
98
+ static oidToString(oidPDU: Uint8Array | number[]): string;
99
+ // static UOSInt OIDCalcPDUSize(const UTF8Char *oidText, UOSInt oidTextLen);
100
+ static oidText2PDU(oidText: string): number[];
101
+
102
+ // static void OIDToCPPCode(const UInt8 *oid, UOSInt oidLen, const UTF8Char *objectName, UOSInt nameLen, NotNullPtr<Text::StringBuilderUTF8> sb);
103
+
104
+ static booleanToString(reader: data.ByteReader, ofst: number, len: number): string;
105
+ static integerToString(reader: data.ByteReader, ofst: number, len: number): string;
106
+ static utcTimeToString(reader: data.ByteReader, ofst: number, len: number): string;
107
+ static itemTypeGetName(itemType: ASN1ItemType): string;
108
+ static str2Digit(reader: data.ByteReader, ofst: number): number;
109
+ }
110
+
111
+ declare class NameRule
112
+ {
113
+ cond: RuleCond;
114
+ itemType: ASN1ItemType;
115
+ condParam: string | null;
116
+ name: string;
117
+ contentFunc?: (names: ASN1Names)=>void;
118
+ enumVals?: string[];
119
+ }
120
+
121
+ declare class RuleContainer
122
+ {
123
+ rules: NameRule[];
124
+ parent: RuleContainer;
125
+
126
+ constructor();
127
+ }
128
+
129
+ export class ASN1Names
130
+ {
131
+ private addRule(rule: RuleCond): void;
132
+
133
+ constructor();
134
+
135
+ readBegin(): void;
136
+ readName(itemType: ASN1ItemType, len: number, reader: data.ByteReader, ofst: number): string;
137
+ readNameNoDef(itemType: ASN1ItemType, len: number, reader: data.ByteReader, ofst: number): string | null;
138
+ readContainer(): void;
139
+ readContainerEnd(): void;
140
+
141
+ anyCond(): ASN1Names;
142
+ typeIs(itemType: ASN1ItemType): ASN1Names;
143
+ typeIsTime(): ASN1Names;
144
+ typeIsString(): ASN1Names;
145
+ typeIsOpt(index: number): ASN1Names;
146
+ repeatIfTypeIs(itemType: ASN1ItemType): ASN1Names;
147
+ lastOIDAndTypeIs(oidText: string, itemType: ASN1ItemType): ASN1Names;
148
+ allNotMatch(): ASN1Names;
149
+
150
+ container(name: string, contFunc: (name: ASN1Names)=>void): ASN1Names;
151
+ nextValue(name: string): ASN1Names;
152
+ enum(name: string, enums: string[]): ASN1Names;
153
+
154
+ setCertificate(): ASN1Names; //PKIX1Explicit88
155
+ setRSAPublicKey(): ASN1Names; //PKCS-1
156
+ setRSAPrivateKey(): ASN1Names; //PKCS-1
157
+ setPKCS7ContentInfo(): ASN1Names; //PKCS-7
158
+ setCertificationRequest(): ASN1Names; //PKCS-10
159
+ setCertificateList(): ASN1Names; //RFC5280
160
+ setPFX(): ASN1Names; //PKCS-12
161
+ }
162
+
163
+ class General
164
+ {
165
+ static pbeParam(names: ASN1Names): void;
166
+ static extendedValidationCertificates(names: ASN1Names): void;
167
+ static attributeOutlookExpress(names: ASN1Names): void;
168
+ }
169
+
170
+ class InformationFramework
171
+ {
172
+ static attributeCont(names: ASN1Names): void;
173
+ }
174
+
175
+ class PKCS1
176
+ {
177
+ static rsaPublicKey(names: ASN1Names): void;
178
+ static rsaPublicKeyCont(names: ASN1Names): void;
179
+ static rsaPrivateKey(names: ASN1Names): void;
180
+ static rsaPrivateKeyCont(names: ASN1Names): void;
181
+ static otherPrimeInfos(names: ASN1Names): void;
182
+ static addDigestInfo(names: ASN1Names, name: string): void;
183
+ static digestInfoCont(names: ASN1Names): void;
184
+ }
185
+
186
+ class PKCS7
187
+ {
188
+ static addContentInfo(names: ASN1Names, name: string): void;
189
+ static contentInfo(names: ASN1Names): void;
190
+ static contentInfoCont(names: ASN1Names): void;
191
+ static data(names: ASN1Names): void;
192
+ static signedData(names: ASN1Names): void;
193
+ static signedDataCont(names: ASN1Names): void;
194
+ static digestAlgorithmIdentifiers(names: ASN1Names): void;
195
+ static certificateSet(names: ASN1Names): void;
196
+ static certificateRevocationLists(names: ASN1Names): void;
197
+ static signerInfos(names: ASN1Names): void;
198
+ static signerInfoCont(names: ASN1Names): void;
199
+ static issuerAndSerialNumberCont(names: ASN1Names): void;
200
+ static addDigestInfo(names: ASN1Names, name: string): void;
201
+ static digestInfoCont(names: ASN1Names): void;
202
+ static envelopedData(names: ASN1Names): void;
203
+ static envelopedDataCont(names: ASN1Names): void;
204
+ static originatorInfoCont(names: ASN1Names): void;
205
+ static recipientInfos(names: ASN1Names): void;
206
+ static keyTransportRecipientInfoCont(names: ASN1Names): void;
207
+ static signedAndEnvelopedData(names: ASN1Names): void;
208
+ static signedAndEnvelopedDataCont(names: ASN1Names): void;
209
+ static digestedData(names: ASN1Names): void;
210
+ static digestedDataCont(names: ASN1Names): void;
211
+ static encryptedData(names: ASN1Names): void;
212
+ static encryptedDataCont(names: ASN1Names): void;
213
+ static encryptedContentInfoCont(names: ASN1Names): void;
214
+ static authenticatedData(names: ASN1Names): void;
215
+ }
216
+
217
+ class PKCS8
218
+ {
219
+ static privateKeyInfo(names: ASN1Names): void;
220
+ static privateKeyInfoCont(names: ASN1Names): void;
221
+ static encryptedPrivateKeyInfo(names: ASN1Names): void;
222
+ static encryptedPrivateKeyInfoCont(names: ASN1Names): void;
223
+ }
224
+
225
+ class PKCS9
226
+ {
227
+ static attributeContentType(names: ASN1Names): void;
228
+ static attributeMessageDigest(names: ASN1Names): void;
229
+ static attributeSigningTime(names: ASN1Names): void;
230
+ static attributeFriendlyName(names: ASN1Names): void;
231
+ static attributeSMIMECapabilities(names: ASN1Names): void;
232
+ static attributeLocalKeyId(names: ASN1Names): void;
233
+ static smimeCapabilitiesCont(names: ASN1Names): void;
234
+ static smimeCapabilityCont(names: ASN1Names): void;
235
+ }
236
+
237
+ class PKCS10
238
+ {
239
+ static addCertificationRequestInfo(names: ASN1Names, name: string): void;
240
+ static certificationRequestInfoCont(names: ASN1Names): void;
241
+ static attributesCont(names: ASN1Names): void;
242
+ static certificationRequest(names: ASN1Names): void;
243
+ static certificationRequestCont(names: ASN1Names): void;
244
+ }
245
+
246
+ class PKCS12
247
+ {
248
+ static pfx(names: ASN1Names): void;
249
+ static pfxCont(names: ASN1Names): void;
250
+ static addMacData(names: ASN1Names, name: string): void;
251
+ static macDataCont(names: ASN1Names): void;
252
+ static authenticatedSafeContentInfoCont(names: ASN1Names): void;
253
+ static authenticatedSafeData(names: ASN1Names): void;
254
+ static authenticatedSafeEnvelopedData(names: ASN1Names): void;
255
+ static authenticatedSafeEncryptedData(names: ASN1Names): void;
256
+ static authenticatedSafe(names: ASN1Names): void;
257
+ static authSafeContentInfo(names: ASN1Names): void;
258
+ static authSafeContentInfoCont(names: ASN1Names): void;
259
+ static safeContentsData(names: ASN1Names): void;
260
+ static safeContents(names: ASN1Names): void;
261
+ static safeContentsCont(names: ASN1Names): void;
262
+ static safeBagCont(names: ASN1Names): void;
263
+ static certBag(names: ASN1Names): void;
264
+ static certBagCont(names: ASN1Names): void;
265
+ static x509Certificate(names: ASN1Names): void;
266
+ static sdsiCertificate(names: ASN1Names): void;
267
+ static crlBag(names: ASN1Names): void;
268
+ static crlBagCont(names: ASN1Names): void;
269
+ static x509CRL(names: ASN1Names): void;
270
+ static secretBag(names: ASN1Names): void;
271
+ static secretBagCont(names: ASN1Names): void;
272
+ static pkcs12Attributes(names: ASN1Names): void;
273
+ }
274
+
275
+ class PKIX1Explicit88
276
+ {
277
+ static addAttributeTypeAndValue(names: ASN1Names, name: string): void;
278
+ static attributeTypeAndValueCont(names: ASN1Names): void;
279
+ static addName(names: ASN1Names, name: string): void;
280
+ static name(names: ASN1Names): void;
281
+ static rdnSequenceCont(names: ASN1Names): void;
282
+ static relativeDistinguishedName(names: ASN1Names): void;
283
+ static relativeDistinguishedNameCont(names: ASN1Names): void;
284
+ static certificate(names: ASN1Names): void;
285
+ static certificateCont(names: ASN1Names): void;
286
+ static addTBSCertificate(names: ASN1Names, name: string): void;
287
+ static tbsCertificateCont(names: ASN1Names): void;
288
+ static version(names: ASN1Names): void;
289
+ static addValidity(names: ASN1Names, name: string): void;
290
+ static validityCont(names: ASN1Names): void;
291
+ static addSubjectPublicKeyInfo(names: ASN1Names, name: string): void;
292
+ static subjectPublicKeyInfoCont(names: ASN1Names): void;
293
+ static addExtensions(names: ASN1Names, name: string): void;
294
+ static extensions(names: ASN1Names): void;
295
+ static extensionsCont(names: ASN1Names): void;
296
+ static extensionCont(names: ASN1Names): void;
297
+ static certificateList(names: ASN1Names): void;
298
+ static certificateListCont(names: ASN1Names): void;
299
+ static addTBSCertList(names: ASN1Names, name: string): void;
300
+ static tbsCertListCont(names: ASN1Names): void;
301
+ static revokedCertificates(names: ASN1Names): void;
302
+ static revokedCertificateCont(names: ASN1Names): void;
303
+ static addAlgorithmIdentifier(names: ASN1Names, name: string): void;
304
+ static algorithmIdentifierCont(names: ASN1Names): void;
305
+ }
306
+
307
+ declare class PKIX1Implicit88
308
+ {
309
+ static authorityKeyIdentifier(names: ASN1Names): void;
310
+ static authorityKeyIdentifierCont(names: ASN1Names): void;
311
+ static subjectKeyIdentifier(names: ASN1Names): void;
312
+ static keyUsage(names: ASN1Names): void;
313
+ static certificatePolicies(names: ASN1Names): void;
314
+ static certificatePoliciesCont(names: ASN1Names): void;
315
+ static policyInformationCont(names: ASN1Names): void;
316
+ static policyQualifiers(names: ASN1Names): void;
317
+ static policyQualifierInfoCont(names: ASN1Names): void;
318
+ static generalNames(names: ASN1Names): void;
319
+ static generalNameCont(names: ASN1Names): void;
320
+ static basicConstraints(names: ASN1Names): void;
321
+ static basicConstraintsCont(names: ASN1Names): void;
322
+ static crlDistributionPoints(names: ASN1Names): void;
323
+ static crlDistributionPointsCont(names: ASN1Names): void;
324
+ static distributionPointCont(names: ASN1Names): void;
325
+ static distributionPointName(names: ASN1Names): void;
326
+ static reasonFlags(names: ASN1Names): void;
327
+ static extKeyUsageSyntax(names: ASN1Names): void;
328
+ static extKeyUsageSyntaxCont(names: ASN1Names): void;
329
+ }
330
+
331
+ declare class RFC2459
332
+ {
333
+ static authorityInfoAccessSyntax(names: ASN1Names): void;
334
+ static authorityInfoAccessSyntaxCont(names: ASN1Names): void;
335
+ static accessDescriptionCont(names: ASN1Names): void;
336
+ }
337
+
338
+ declare class RFC8551
339
+ {
340
+ static smimeEncryptionKeyPreference(names: ASN1Names): void;
341
+ }
342
+
343
+ export class ASN1PDUBuilder
344
+ {
345
+ seqOffset: number[];
346
+ buff: number[];
347
+
348
+ constructor();
349
+
350
+ beginOther(type: ASN1ItemType): void;
351
+ beginSequence(): void;
352
+ beginSet(): void;
353
+ beginContentSpecific(n: number): void;
354
+ endLevel(): void;
355
+ endAll(): void;
356
+ appendBool(v: boolean): void;
357
+ appendInt32(v: number): void;
358
+ appendBitString(bitLeft: number, buff: ArrayBuffer): void;
359
+ appendOctetString(buff: ArrayBuffer | string): void;
360
+ appendNull(): void;
361
+ appendOID(buff: ArrayBuffer): void;
362
+ appendOIDString(oidStr: string): void;
363
+ appendChoice(v: number): void;
364
+ appendPrintableString(s: string): void;
365
+ appendUTF8String(s: string): void;
366
+ appendIA5String(s: string): void;
367
+ appendUTCTime(t: data.Timestamp): void;
368
+ appendOther(type: ASN1ItemType, buff: ArrayBuffer): void;
369
+ appendContentSpecific(n: number, buff: ArrayBuffer): void;
370
+ appendSequence(buff: ArrayBuffer): void;
371
+ appendInteger(buff: ArrayBuffer): void;
372
+
373
+ getArrayBuffer(): ArrayBuffer;
374
+ appendTypeLen(type: ASN1ItemType, len: number): void;
375
+ appendArrayBuffer(buff: ArrayBuffer): void;
376
+ }