@sswroom/sswr 1.6.9 → 1.6.11

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/Changelog CHANGED
@@ -1,3 +1,18 @@
1
+ 1.6.11
2
+ -media.EXIFData.getPhotoLocation fixed getting problem
3
+ -Added media.EXIFData.toString
4
+ -Added cert.X509Key.signatureVerify
5
+ -Change cert.X509File.isValid to return Promise<>
6
+ -Enhance cert.js function types
7
+ -Added data.readUInt64, readMUInt64
8
+ -Added data.ByteReader.readInt64, readUInt64
9
+ -Added dummy/olayer2.js
10
+ -Enhance olayer2.js
11
+ -Added text.b64Enc and text.b64Dec
12
+
13
+ 1.6.10
14
+ -web.getBrowserInfo enhance iPad Pro detection
15
+
1
16
  1.6.9
2
17
  -Enhance web.getBrowserInfo
3
18
  -web.parseUserAgent support FxiOS (Firefox in iOS)
package/cert.d.ts CHANGED
@@ -127,7 +127,7 @@ export abstract class X509File extends ASN1Data
127
127
  getCertCount(): number;
128
128
  getCertName(index: number): string | null;
129
129
  getNewCert(index: number): X509Cert | null;
130
- abstract isValid(): CertValidStatus;
130
+ abstract isValid(): Promise<CertValidStatus>;
131
131
 
132
132
  toShortString(): string;
133
133
  isSignatureKey(key: X509Key): boolean;
@@ -213,7 +213,7 @@ export class X509Cert extends X509File
213
213
  getCertCount(): number;
214
214
  getCertName(index: number): string | null;
215
215
  getNewCert(index: number): X509Cert | null;
216
- isValid(): CertValidStatus;
216
+ isValid(): Promise<CertValidStatus>;
217
217
 
218
218
  clone(): ASN1Data;
219
219
  createX509Cert(): X509Cert;
@@ -241,7 +241,7 @@ export class X509CertReq extends X509File
241
241
 
242
242
  getFileType(): X509FileType;
243
243
  toShortName(): string;
244
- isValid(): CertValidStatus;
244
+ isValid(): Promise<CertValidStatus>;
245
245
 
246
246
  clone(): X509CertReq;
247
247
  toString(): string;
@@ -258,7 +258,7 @@ export class X509Key extends X509File
258
258
  constructor(sourceName: string, buff: ArrayBuffer, keyType: KeyType);
259
259
  getFileType(): X509FileType;
260
260
  toShortName(): string;
261
- isValid(): CertValidStatus;
261
+ isValid(): Promise<CertValidStatus>;
262
262
  clone(): X509Key;
263
263
  toString(): string;
264
264
  createNames(): ASN1Names;
@@ -281,7 +281,7 @@ export class X509Key extends X509File
281
281
  getECPrivate(): ArrayBuffer | null;
282
282
  getECPublic(): ArrayBuffer | null;
283
283
  getECName(): ECName;
284
-
284
+ signatureVerify(hashType: hash.HashType, payload: ArrayBuffer, signature: ArrayBuffer): Promise<boolean>;
285
285
  static fromECPublicKey(buff: ArrayBuffer, paramOID: ArrayBuffer): X509Key;
286
286
  }
287
287
 
@@ -291,7 +291,7 @@ export class X509PrivKey extends X509File
291
291
 
292
292
  getFileType(): X509FileType;
293
293
  toShortName(): string;
294
- isValid(): CertValidStatus;
294
+ isValid(): Promise<CertValidStatus>;
295
295
 
296
296
  clone(): X509PrivKey;
297
297
  toString(): string;
@@ -310,7 +310,7 @@ export class X509PubKey extends X509File
310
310
 
311
311
  getFileType(): X509FileType;
312
312
  toShortName(): string;
313
- isValid(): CertValidStatus;
313
+ isValid(): Promise<CertValidStatus>;
314
314
  clone(): X509PubKey;
315
315
  toString(): string;
316
316
  createNames(): ASN1Names;
@@ -331,7 +331,7 @@ export class X509PKCS7 extends X509File
331
331
  getCertCount(): number;
332
332
  getCertName(index: number): string;
333
333
  getNewCert(index: number): X509Cert;
334
- isValid(): CertValidStatus;
334
+ isValid(): Promise<CertValidStatus>;
335
335
 
336
336
  clone(): X509PKCS7;
337
337
  toString(): string;
@@ -352,7 +352,7 @@ export class X509PKCS12 extends X509File
352
352
  getCertCount(): number;
353
353
  getCertName(index: number): string;
354
354
  getNewCert(index: number): X509Cert;
355
- isValid(): CertValidStatus;
355
+ isValid(): Promise<CertValidStatus>;
356
356
 
357
357
  clone(): X509PKCS12;
358
358
  toString(): string;
@@ -371,7 +371,7 @@ export class X509FileList extends X509File
371
371
  getCertCount(): number;
372
372
  getCertName(index: number): string | null;
373
373
  getNewCert(index: number): X509Cert | null;
374
- isValid(): CertValidStatus;
374
+ isValid(): Promise<CertValidStatus>;
375
375
 
376
376
  clone(): X509FileList;
377
377
  createX509Cert(): X509Cert;
@@ -390,7 +390,7 @@ export class X509CRL extends X509File
390
390
 
391
391
  getFileType(): X509FileType;
392
392
  toShortName(): string;
393
- isValid(): CertValidStatus;
393
+ isValid(): Promise<CertValidStatus>;
394
394
 
395
395
  clone(): X509CRL;
396
396
  toString(): string;
package/cert.js CHANGED
@@ -87,6 +87,14 @@ export class ASN1Data extends data.ParsedObject
87
87
  return lines.join("\r\n");
88
88
  }
89
89
 
90
+ /**
91
+ * @returns {ASN1Names|null}
92
+ */
93
+ createNames()
94
+ {
95
+ throw new Error("createNames must be inherit");
96
+ }
97
+
90
98
  getASN1Buff()
91
99
  {
92
100
  return this.reader;
@@ -130,15 +138,39 @@ export class ASN1Data extends data.ParsedObject
130
138
  export class X509File extends ASN1Data
131
139
  {
132
140
  /**
133
- * @param {any} sourceName
134
- * @param {any} objType
135
- * @param {any} buff
141
+ * @param {string} sourceName
142
+ * @param {string} objType
143
+ * @param {ArrayBuffer} buff
136
144
  */
137
145
  constructor(sourceName, objType, buff)
138
146
  {
139
147
  super(sourceName, objType, buff);
140
148
  }
141
149
 
150
+ /**
151
+ * @returns {number}
152
+ */
153
+ getFileType()
154
+ {
155
+ throw new Error("getFileType must be inherited");
156
+ }
157
+
158
+ /**
159
+ * @returns {string|null}
160
+ */
161
+ toShortName()
162
+ {
163
+ throw new Error("toShortName must be inherited");
164
+ }
165
+
166
+ /**
167
+ * @returns {Promise<string>}
168
+ */
169
+ async isValid()
170
+ {
171
+ return CertValidStatus.FileFormatInvalid;
172
+ }
173
+
142
174
  getASN1Type()
143
175
  {
144
176
  return ASN1Type.X509;
@@ -150,7 +182,8 @@ export class X509File extends ASN1Data
150
182
  }
151
183
 
152
184
  /**
153
- * @param {any} index
185
+ * @param {number} index
186
+ * @returns {string|null}
154
187
  */
155
188
  getCertName(index)
156
189
  {
@@ -158,7 +191,8 @@ export class X509File extends ASN1Data
158
191
  }
159
192
 
160
193
  /**
161
- * @param {any} index
194
+ * @param {number} index
195
+ * @returns {X509Cert|null}
162
196
  */
163
197
  getNewCert(index)
164
198
  {
@@ -330,7 +364,7 @@ export class X509File extends ASN1Data
330
364
  * @param {number} endOfst
331
365
  * @param {string} path
332
366
  * @param {string[]} sb
333
- * @param {string} varName
367
+ * @param {string|null} varName
334
368
  */
335
369
  static appendTBSCertificate(reader, startOfst, endOfst, path, sb, varName)
336
370
  {
@@ -522,7 +556,7 @@ export class X509File extends ASN1Data
522
556
  * @param {number} endOfst
523
557
  * @param {string} path
524
558
  * @param {(string | number)[]} sb
525
- * @param {string} varName
559
+ * @param {string|null} varName
526
560
  */
527
561
  static appendTBSCertList(reader, startOfst, endOfst, path, sb, varName)
528
562
  {
@@ -675,7 +709,7 @@ export class X509File extends ASN1Data
675
709
  * @param {number} endOfst
676
710
  * @param {string} path
677
711
  * @param {any[]} sb
678
- * @param {string} varName
712
+ * @param {string|null} varName
679
713
  */
680
714
  static appendCertificateList(reader, startOfst, endOfst, path, sb, varName)
681
715
  {
@@ -999,10 +1033,10 @@ export class X509File extends ASN1Data
999
1033
  sb.push("content-type = ");
1000
1034
  sb.push(ASN1Util.oidToString(reader.getU8Arr(contentType.dataOfst, contentType.contLen)));
1001
1035
  let oid = null; //oiddb.oidGetEntry(reader.getU8Arr(contentType.dataOfst, contentType.contLen));
1002
- if (oid)
1036
+ /*if (oid)
1003
1037
  {
1004
1038
  sb.push(" ("+oid.name+')');
1005
- }
1039
+ }*/
1006
1040
  sb.push("\r\n");
1007
1041
  }
1008
1042
  if (contentType && content)
@@ -1121,7 +1155,7 @@ export class X509File extends ASN1Data
1121
1155
  * @param {number} startOfst
1122
1156
  * @param {number} endOfst
1123
1157
  * @param {string} path
1124
- * @param {string[]} sb
1158
+ * @param {(string|number)[]} sb
1125
1159
  */
1126
1160
  static appendVersion(reader, startOfst, endOfst, path, sb)
1127
1161
  {
@@ -1150,7 +1184,7 @@ export class X509File extends ASN1Data
1150
1184
  * @param {data.ByteReader} reader
1151
1185
  * @param {number} startOfst
1152
1186
  * @param {number} endOfst
1153
- * @param {string[]} sb
1187
+ * @param {(string|number)[]} sb
1154
1188
  * @param {string} varName
1155
1189
  * @param {boolean} pubKey
1156
1190
  */
@@ -1168,10 +1202,10 @@ export class X509File extends ASN1Data
1168
1202
  sb.push(ASN1Util.oidToString(new Uint8Array(reader.getArrayBuffer(algorithm.rawOfst + algorithm.hdrLen, algorithm.contLen))));
1169
1203
  keyType = X509File.keyTypeFromOID(new Uint8Array(reader.getArrayBuffer(algorithm.rawOfst + algorithm.hdrLen, algorithm.contLen)), pubKey);
1170
1204
  let oid = null; //oiddb.oidGetEntry(new Uint8Array(reader.getArrayBuffer(algorithm.rawOfst + algorithm.hdrLen, algorithm.contLen)));
1171
- if (oid)
1205
+ /*if (oid)
1172
1206
  {
1173
1207
  sb.push(" (" + oid.name + ")");
1174
- }
1208
+ }*/
1175
1209
  sb.push("\r\n");
1176
1210
  }
1177
1211
  if (parameters)
@@ -1237,10 +1271,10 @@ export class X509File extends ASN1Data
1237
1271
  sb.push(".ecPublicKey.parameters = ");
1238
1272
  sb.push(ASN1Util.oidToString(new Uint8Array(reader.getArrayBuffer(parameters.rawOfst + parameters.hdrLen, parameters.contLen))));
1239
1273
  let oidInfo = null; //oiddb.oidGetEntry(new Uint8Array(reader.getArrayBuffer(parameters.rawOfst + parameters.hdrLen, parameters.contLen)));
1240
- if (oidInfo)
1274
+ /*if (oidInfo)
1241
1275
  {
1242
1276
  sb.push(" ("+oidInfo.name+")");
1243
- }
1277
+ }*/
1244
1278
  sb.push("\r\n");
1245
1279
  }
1246
1280
  else
@@ -1503,10 +1537,10 @@ export class X509File extends ASN1Data
1503
1537
  sb.push("extensionType = ");
1504
1538
  sb.push(ASN1Util.oidToString(reader.getU8Arr(extension.dataOfst, extension.contLen)));
1505
1539
  let oid = null; //oiddb.oidGetEntry(reader.getU8Arr(extension.dataOfst, extension.contLen));
1506
- if (oid)
1540
+ /*if (oid)
1507
1541
  {
1508
1542
  sb.push(" ("+oid.name+')');
1509
- }
1543
+ }*/
1510
1544
  sb.push("\r\n");
1511
1545
  }
1512
1546
  }
@@ -1972,10 +2006,10 @@ export class X509File extends ASN1Data
1972
2006
  sb.push(ASN1Util.oidToString(reader.getU8Arr(subItemPDU.dataOfst, subItemPDU.contLen)));
1973
2007
  {
1974
2008
  let ent = null; //oiddb.oidGetEntry(reader.getU8Arr(subItemPDU.dataOfst, subItemPDU.contLen));
1975
- if (ent)
2009
+ /*if (ent)
1976
2010
  {
1977
2011
  sb.push(" ("+ent.name+')');
1978
- }
2012
+ }*/
1979
2013
  }
1980
2014
  sb.push("\r\n");
1981
2015
  return true;
@@ -2337,10 +2371,10 @@ export class X509File extends ASN1Data
2337
2371
  sb.push(".attributeType = ");
2338
2372
  sb.push(ASN1Util.oidToString(reader.getU8Arr(oidPDU.dataOfst, oidPDU.contLen)));
2339
2373
  let oid = null; //oiddb.oidGetEntry(reader.getU8Arr(oidPDU.dataOfst, oidPDU.contLen));
2340
- if (oid)
2374
+ /*if (oid)
2341
2375
  {
2342
2376
  sb.push(" ("+oid.name+")");
2343
- }
2377
+ }*/
2344
2378
  sb.push("\r\n");
2345
2379
  }
2346
2380
  if (valuePDU && valuePDU.itemType == ASN1ItemType.SET)
@@ -2354,10 +2388,10 @@ export class X509File extends ASN1Data
2354
2388
  sb.push(".contentType = ");
2355
2389
  sb.push(ASN1Util.oidToString(reader.getU8Arr(itemPDU.dataOfst, itemPDU.contLen)));
2356
2390
  let oid = null; //oiddb.oidGetEntry(reader.getU8Arr(itemPDU.dataOfst, itemPDU.contLen));
2357
- if (oid)
2391
+ /*if (oid)
2358
2392
  {
2359
2393
  sb.push(" ("+oid.name+")");
2360
- }
2394
+ }*/
2361
2395
  sb.push("\r\n");
2362
2396
  }
2363
2397
  }
@@ -2520,7 +2554,7 @@ export class X509File extends ASN1Data
2520
2554
  if ((subitemPDU = ASN1Util.pduGetItem(reader, itemPDU.dataOfst, itemPDU.endOfst, "3")) != null && subitemPDU.itemType == ASN1ItemType.CONTEXT_SPECIFIC_0)
2521
2555
  {
2522
2556
  let name = "unprotectedAttributes";
2523
- if (varName.v)
2557
+ if (varName)
2524
2558
  {
2525
2559
  name = varName+"."+name;
2526
2560
  }
@@ -2570,10 +2604,10 @@ export class X509File extends ASN1Data
2570
2604
  sb.push(".contentType = ");
2571
2605
  sb.push(ASN1Util.oidToString(reader.getU8Arr(itemPDU.dataOfst, itemPDU.contLen)));
2572
2606
  let oid = null; //oiddb.oidGetEntry(reader.getU8Arr(itemPDU.dataOfst, itemPDU.contLen));
2573
- if (oid)
2607
+ /*if (oid)
2574
2608
  {
2575
2609
  sb.push(" ("+oid.name+")");
2576
- }
2610
+ }*/
2577
2611
  sb.push("\r\n");
2578
2612
  }
2579
2613
  if ((itemPDU = ASN1Util.pduGetItem(reader, startOfst, endOfst, "2")) != null && itemPDU.itemType == ASN1ItemType.SEQUENCE)
@@ -2875,9 +2909,9 @@ export class X509File extends ASN1Data
2875
2909
  let itemPDU;
2876
2910
  if ((itemPDU = ASN1Util.pduGetItem(reader, startOfst, endOfst, "1")) != null && itemPDU.itemType == ASN1ItemType.CONTEXT_SPECIFIC_0)
2877
2911
  {
2878
- if ((itemPDU = ASN1Util.pduGetItem(reader.getU8Arr(itemPDU.rawOfst), itemPDU.hdrLen, itemPDU.rawOfst + itemPDU.hdrLen + itemPDU.contLen, "1")) != null && itemPDU.itemType == ASN1ItemType.CONTEXT_SPECIFIC_0)
2912
+ if ((itemPDU = ASN1Util.pduGetItem(reader, itemPDU.rawOfst + itemPDU.hdrLen, itemPDU.rawOfst + itemPDU.hdrLen + itemPDU.contLen, "1")) != null && itemPDU.itemType == ASN1ItemType.CONTEXT_SPECIFIC_0)
2879
2913
  {
2880
- if ((itemPDU = ASN1Util.pduGetItem(reader.getU8Arr(itemPDU.rawOfst), itemPDU.hdrLen, itemPDU.rawOfst + itemPDU.hdrLen + itemPDU.contLen, "1")) != null && itemPDU.itemType == ASN1ItemType.CHOICE_6)
2914
+ if ((itemPDU = ASN1Util.pduGetItem(reader, itemPDU.rawOfst + itemPDU.hdrLen, itemPDU.rawOfst + itemPDU.hdrLen + itemPDU.contLen, "1")) != null && itemPDU.itemType == ASN1ItemType.CHOICE_6)
2881
2915
  {
2882
2916
  distPoints.push(reader.readUTF8(itemPDU.rawOfst + itemPDU.hdrLen, itemPDU.contLen));
2883
2917
  return true;
@@ -2974,7 +3008,11 @@ export class X509File extends ASN1Data
2974
3008
  */
2975
3009
  static keyTypeFromOID(oid, pubKey)
2976
3010
  {
2977
- let arr = new Uint8Array(oid);
3011
+ let arr;
3012
+ if (oid instanceof ArrayBuffer)
3013
+ arr = new Uint8Array(oid);
3014
+ else
3015
+ arr = new Uint8Array(oid);
2978
3016
  if (ASN1Util.oidEqualsText(arr, "1.2.840.113549.1.1.1"))
2979
3017
  {
2980
3018
  if (pubKey)
@@ -3151,7 +3189,7 @@ export class X509Cert extends X509File
3151
3189
  return this.clone();
3152
3190
  }
3153
3191
 
3154
- isValid()
3192
+ async isValid()
3155
3193
  {
3156
3194
  /*
3157
3195
  if (trustStore == 0)
@@ -3204,7 +3242,7 @@ export class X509Cert extends X509File
3204
3242
  {
3205
3243
  return CertValidStatus.FileFormatInvalid;
3206
3244
  }
3207
- let signValid = key.signatureVerify(hashType, signedInfo.payload, signedInfo.signature);
3245
+ let signValid = await key.signatureVerify(hashType, signedInfo.payload, signedInfo.signature);
3208
3246
  if (signValid)
3209
3247
  {
3210
3248
  return CertValidStatus.SelfSigned;
@@ -3215,7 +3253,7 @@ export class X509Cert extends X509File
3215
3253
  }
3216
3254
  }
3217
3255
 
3218
- let key = issuer.getNewPublicKey();
3256
+ /* let key = issuer.getNewPublicKey();
3219
3257
  if (key == null)
3220
3258
  {
3221
3259
  return CertValidStatus.FileFormatInvalid;
@@ -3226,7 +3264,7 @@ export class X509Cert extends X509File
3226
3264
  return CertValidStatus.SignatureInvalid;
3227
3265
  }
3228
3266
 
3229
- let crlDistributionPoints = this.getCRLDistributionPoints();
3267
+ let crlDistributionPoints = this.getCRLDistributionPoints();*/
3230
3268
  //////////////////////////
3231
3269
  // CRL
3232
3270
  return CertValidStatus.Valid;
@@ -3584,7 +3622,7 @@ export class X509CertReq extends X509File
3584
3622
  return "";
3585
3623
  }
3586
3624
 
3587
- isValid()
3625
+ async isValid()
3588
3626
  {
3589
3627
  let signedInfo;
3590
3628
  if ((signedInfo = this.getSignedInfo()) == null)
@@ -3601,7 +3639,7 @@ export class X509CertReq extends X509File
3601
3639
  {
3602
3640
  return CertValidStatus.FileFormatInvalid;
3603
3641
  }
3604
- let valid = key.signatureVerify(hashType, signedInfo.payload, signedInfo.signature);
3642
+ let valid = await key.signatureVerify(hashType, signedInfo.payload, signedInfo.signature);
3605
3643
  if (valid)
3606
3644
  {
3607
3645
  return CertValidStatus.Valid;
@@ -3704,7 +3742,7 @@ export class X509Key extends X509File
3704
3742
  return keyTypeGetName(this.keyType)+" "+this.getKeySizeBits()+" bits";
3705
3743
  }
3706
3744
 
3707
- isValid()
3745
+ async isValid()
3708
3746
  {
3709
3747
  if (this.keyType == KeyType.Unknown)
3710
3748
  {
@@ -4086,6 +4124,60 @@ export class X509Key extends X509File
4086
4124
  return ECName.Unknown;
4087
4125
  }
4088
4126
 
4127
+ /**
4128
+ * @param {hash.HashType} hashType
4129
+ * @param {ArrayBuffer} payload
4130
+ * @param {ArrayBuffer} signature
4131
+ */
4132
+ async signatureVerify(hashType, payload, signature)
4133
+ {
4134
+ let privKey = X509PrivKey.createFromKey(this);
4135
+ if (privKey == null)
4136
+ {
4137
+ return false;
4138
+ }
4139
+ let alg;
4140
+ if (this.keyType == KeyType.RSA)
4141
+ {
4142
+ alg = {name: "RSASSA-PKCS1-v1_5", hash: "SHA-256"};
4143
+ switch (hashType)
4144
+ {
4145
+ case hash.HashType.SHA1:
4146
+ alg.hash = "SHA-1";
4147
+ break;
4148
+ case hash.HashType.SHA224:
4149
+ alg.hash = "SHA-224";
4150
+ break;
4151
+ case hash.HashType.SHA256:
4152
+ alg.hash = "SHA-256";
4153
+ break;
4154
+ case hash.HashType.SHA384:
4155
+ alg.hash = "SHA-384";
4156
+ break;
4157
+ case hash.HashType.SHA512:
4158
+ alg.hash = "SHA-512";
4159
+ break;
4160
+ }
4161
+ }
4162
+ else if (this.keyType == KeyType.ECDSA)
4163
+ {
4164
+ return false;
4165
+ }
4166
+ else
4167
+ {
4168
+ return false;
4169
+ }
4170
+ let key = await window.crypto.subtle.importKey("pkcs8", privKey.getASN1Buff().getArrayBuffer(), alg, false, ["verify"]);
4171
+ let result = await window.crypto.subtle.verify(
4172
+ "RSASSA-PKCS1-v1_5",
4173
+ key,
4174
+ signature,
4175
+ payload
4176
+ );
4177
+
4178
+ return result;
4179
+ }
4180
+
4089
4181
  /**
4090
4182
  * @param {ArrayBuffer} buff
4091
4183
  * @param {ArrayBuffer} paramOID
@@ -4144,7 +4236,7 @@ export class X509PrivKey extends X509File
4144
4236
  }
4145
4237
  }
4146
4238
 
4147
- isValid()
4239
+ async isValid()
4148
4240
  {
4149
4241
  return CertValidStatus.SignatureInvalid;
4150
4242
  }
@@ -4219,7 +4311,7 @@ export class X509PrivKey extends X509File
4219
4311
  }
4220
4312
 
4221
4313
  /**
4222
- * @param {{ getKeyType: () => any; getECName: () => any; getECPrivate: () => any; getECPublic: () => any; sourceName: any; getASN1Buff: () => { (): any; new (): any; getArrayBuffer: { (): any; new (): any; }; }; }} key
4314
+ * @param {X509Key} key
4223
4315
  */
4224
4316
  static createFromKey(key)
4225
4317
  {
@@ -4310,7 +4402,7 @@ export class X509PubKey extends X509File
4310
4402
  return null;
4311
4403
  }
4312
4404
 
4313
- isValid()
4405
+ async isValid()
4314
4406
  {
4315
4407
  return CertValidStatus.SignatureInvalid;
4316
4408
  }
@@ -4404,6 +4496,7 @@ export class X509PKCS7 extends X509File
4404
4496
 
4405
4497
  toShortName()
4406
4498
  {
4499
+ return null;
4407
4500
  }
4408
4501
 
4409
4502
  getCertCount()
@@ -4461,7 +4554,7 @@ export class X509PKCS7 extends X509File
4461
4554
  return null;
4462
4555
  }
4463
4556
 
4464
- isValid()
4557
+ async isValid()
4465
4558
  {
4466
4559
  return CertValidStatus.SignatureInvalid;
4467
4560
  }
@@ -4565,6 +4658,7 @@ export class X509PKCS12 extends X509File
4565
4658
 
4566
4659
  toShortName()
4567
4660
  {
4661
+ return null;
4568
4662
  }
4569
4663
 
4570
4664
  getCertCount()
@@ -4573,7 +4667,7 @@ export class X509PKCS12 extends X509File
4573
4667
  }
4574
4668
 
4575
4669
  /**
4576
- * @param {any} index
4670
+ * @param {number} index
4577
4671
  */
4578
4672
  getCertName(index)
4579
4673
  {
@@ -4581,14 +4675,14 @@ export class X509PKCS12 extends X509File
4581
4675
  }
4582
4676
 
4583
4677
  /**
4584
- * @param {any} index
4678
+ * @param {number} index
4585
4679
  */
4586
4680
  getNewCert(index)
4587
4681
  {
4588
4682
  return null;
4589
4683
  }
4590
4684
 
4591
- isValid()
4685
+ async isValid()
4592
4686
  {
4593
4687
  return CertValidStatus.SignatureInvalid
4594
4688
  }
@@ -4618,7 +4712,7 @@ export class X509FileList extends X509File
4618
4712
  {
4619
4713
  /**
4620
4714
  * @param {string} sourceName
4621
- * @param {{ reader: { getArrayBuffer: () => any; }; }} cert
4715
+ * @param {X509Cert} cert
4622
4716
  */
4623
4717
  constructor(sourceName, cert)
4624
4718
  {
@@ -4689,7 +4783,7 @@ export class X509FileList extends X509File
4689
4783
  return null;
4690
4784
  }
4691
4785
 
4692
- isValid()
4786
+ async isValid()
4693
4787
  {
4694
4788
  let status;
4695
4789
  let i;
@@ -4699,7 +4793,7 @@ export class X509FileList extends X509File
4699
4793
  for (i in this.fileList)
4700
4794
  {
4701
4795
  file = this.fileList[i];
4702
- status = file.isValid();
4796
+ status = await file.isValid();
4703
4797
  if (status != CertValidStatus.Valid)
4704
4798
  {
4705
4799
  return status;
@@ -4709,7 +4803,7 @@ export class X509FileList extends X509File
4709
4803
  }
4710
4804
  else
4711
4805
  {
4712
- return this.fileList[0].isValid();
4806
+ return await this.fileList[0].isValid();
4713
4807
  }
4714
4808
  }
4715
4809
 
@@ -4819,10 +4913,10 @@ export class X509CRL extends X509File
4819
4913
  return X509File.nameGetCN(this.reader, tmpBuff.dataOfst, tmpBuff.endOfst);
4820
4914
  }
4821
4915
  }
4822
- return "";
4916
+ return null;
4823
4917
  }
4824
4918
 
4825
- isValid()
4919
+ async isValid()
4826
4920
  {
4827
4921
  let issuer = this.getIssuerCN();
4828
4922
  if (issuer == null)
@@ -4862,7 +4956,7 @@ export class X509CRL extends X509File
4862
4956
  {
4863
4957
  return CertValidStatus.UnknownIssuer;
4864
4958
  }
4865
- let key = issuerCert.getNewPublicKey();
4959
+ /* let key = issuerCert.getNewPublicKey();
4866
4960
  if (key == null)
4867
4961
  {
4868
4962
  return CertValidStatus.FileFormatInvalid;
@@ -4871,7 +4965,7 @@ export class X509CRL extends X509File
4871
4965
  if (!signValid)
4872
4966
  {
4873
4967
  return CertValidStatus.SignatureInvalid;
4874
- }
4968
+ }*/
4875
4969
  return CertValidStatus.Valid;
4876
4970
  }
4877
4971
 
@@ -5170,7 +5264,11 @@ export function ecNameGetOID(ecName)
5170
5264
  */
5171
5265
  export function ecNameFromOID(buff)
5172
5266
  {
5173
- let arr = new Uint8Array(buff);
5267
+ let arr;
5268
+ if (buff instanceof ArrayBuffer)
5269
+ arr = new Uint8Array(buff);
5270
+ else
5271
+ arr = new Uint8Array(buff);
5174
5272
  if (ASN1Util.oidEqualsText(arr, "1.2.840.10045.3.1.7"))
5175
5273
  {
5176
5274
  return ECName.secp256r1;
package/certutil.d.ts CHANGED
@@ -84,11 +84,11 @@ export class ASN1Util
84
84
  static pduParseChoice(reader: data.ByteReader, ofst: number, endOfst: number): PDUValueInfo<number>;
85
85
 
86
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;
87
+ static pduToString(reader: data.ByteReader, startOfst: number, endOfst: number, outLines: string[], level: number, names?: ASN1Names|null): number;
88
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 | null): number;
89
+ static pduGetItem(reader: data.ByteReader, startOfst: number, endOfst: number, path: string|null|undefined): PDUInfo;
90
+ static pduGetItemType(reader: data.ByteReader, startOfst: number, endOfst: number, path: string|null|undefined): ASN1ItemType;
91
+ static pduCountItem(reader: data.ByteReader, startOfst: number, endOfst: number, path?: string|null|undefined): number;
92
92
  static pduIsValid(reader: data.ByteReader, startOfst: number, endOfst: number): boolean;
93
93
  // static void PDUAnalyse(NotNullPtr<IO::FileAnalyse::FrameDetail> frame, Data::ByteArrayR buff, UOSInt pduOfst, UOSInt pduEndOfst, Net::ASN1Names *names);
94
94
 
package/data.d.ts CHANGED
@@ -31,6 +31,8 @@ export function readUInt24(arr: Uint8Array, index: number): number;
31
31
  export function readMUInt24(arr: Uint8Array, index: number): number;
32
32
  export function readUInt32(arr: Uint8Array, index: number): number;
33
33
  export function readMUInt32(arr: Uint8Array, index: number): number;
34
+ export function readUInt64(arr: Uint8Array, index: number): bigint;
35
+ export function readMUInt64(arr: Uint8Array, index: number): bigint;
34
36
  export function rol32(v: number, n: number): number;
35
37
  export function ror32(v: number, n: number): number;
36
38
  export function shl32(v: number, n: number): number;
@@ -227,10 +229,12 @@ export class ByteReader
227
229
  readUInt16(ofst: number, lsb: boolean): number;
228
230
  readUInt24(ofst: number, lsb: boolean): number;
229
231
  readUInt32(ofst: number, lsb: boolean): number;
232
+ readUInt64(ofst: number, lsb: boolean): bigint;
230
233
  readInt8(ofst: number): number;
231
234
  readInt16(ofst: number, lsb: boolean): number;
232
235
  readInt24(ofst: number, lsb: boolean): number;
233
236
  readInt32(ofst: number, lsb: boolean): number;
237
+ readInt64(ofst: number, lsb: boolean): bigint;
234
238
  readFloat64(ofst: number, lsb: boolean): number;
235
239
  readUTF8(ofst: number, len: number): string;
236
240
  readUTF8Z(ofst: number, maxSize?: number): string;
@@ -252,4 +256,5 @@ export abstract class ParsedObject
252
256
  sourceName: string;
253
257
  objType: string;
254
258
  constructor(sourceName: string, objType: string);
259
+ setSourceName(sourceName: string);
255
260
  }