forked from kjur/jsrsasign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qunit-do-asn1cms.html
executable file
·479 lines (409 loc) · 35.3 KB
/
qunit-do-asn1cms.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>QUnit for ASN1 Encoder Class 'asn1cms.js'</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script src="../ext/cj/cryptojs-312-core-fix.js"></script>
<script src="../ext/cj/x64-core.js"></script>
<script src="../ext/cj/cipher-core_min.js"></script>
<script src="../ext/cj/aes_min.js"></script>
<script src="../ext/cj/tripledes_min.js"></script>
<script src="../ext/cj/enc-base64_min.js"></script>
<script src="../ext/cj/md5_min.js"></script>
<script src="../ext/cj/sha1_min.js"></script>
<script src="../ext/cj/sha256_min.js"></script>
<script src="../ext/cj/sha224_min.js"></script>
<script src="../ext/cj/sha512_min.js"></script>
<script src="../ext/cj/sha384_min.js"></script>
<script src="../ext/cj/ripemd160_min.js"></script>
<script src="../ext/cj/hmac_min.js"></script>
<script src="../ext/cj/pbkdf2_min.js"></script>
<script src="../ext/yahoo.js"></script>
<script src="../ext/jsbn.js"></script>
<script src="../ext/jsbn2.js"></script>
<script src="../ext/prng4.js"></script>
<script src="../ext/rng.js"></script>
<script src="../ext/rsa.js"></script>
<script src="../ext/rsa2.js"></script>
<script src="../ext/base64.js"></script>
<script src="../ext/ec.js"></script>
<script src="../ext/ec-patch.js"></script>
<script src="../src/base64x-1.1.js"></script>
<script src="../src/asn1hex-1.1.js"></script>
<script src="../src/rsapem-1.1.js"></script>
<script src="../src/rsasign-1.2.js"></script>
<script src="../src/crypto-1.1.js"></script>
<script src="../src/keyutil-1.0.js"></script>
<script src="../src/asn1-1.0.js"></script>
<script src="../src/asn1x509-1.0.js"></script>
<script src="../src/asn1cms-1.0.js"></script>
<script src="../src/asn1cades-1.0.js"></script>
<script src="../src/x509-1.1.js"></script>
<script src="../src/ecdsa-modified-1.0.js"></script>
<script src="../src/ecparam-1.0.js"></script>
<script src="../src/dsa-2.0.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
// _test/z4.* RSA 2048bit
var sZ4_PRVP8PPEM =
"-----BEGIN PRIVATE KEY-----\n" +
"MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDfdOqotHd55SYO\n" +
"0dLz2oXengw/tZ+q3ZmOPeVmMuOMIYO/Cv1wk2U0OK4pug4OBSJPhl09Zs6IwB8N\n" +
"wPOU7EDTgMOcQUYB/6QNCI1J7Zm2oLtuchzz4pIb+o4ZAhVprLhRyvqi8OTKQ7kf\n" +
"Gfs5Tuwmn1M/0fQkfzMxADpjOKNgf0uy6lN6utjdTrPKKFUQNdc6/Ty8EeTnQEwU\n" +
"lsT2LAXCfEKxTn5RlRljDztS7Sfgs8VL0FPy1Qi8B+dFcgRYKFrcpsVaZ1lBmXKs\n" +
"XDRu5QR/Rg3f9DRq4GR1sNH8RLY9uApMl2SNz+sR4zRPG85R/se5Q06Gu0BUQ3UP\n" +
"m67ETVZLAgMBAAECggEADjU54mYvHpICXHjc5+JiFqiH8NkUgOG8LL4kwt3DeBp9\n" +
"bP0+5hSJH8vmzwJkeGG9L79EWG4b/bfxgYdeNX7cFFagmWPRFrlxbd64VRYFawZH\n" +
"RJt+2cbzMVI6DL8EK4bu5Ux5qTiV44Jw19hoD9nDzCTfPzSTSGrKD3iLPdnREYaI\n" +
"GDVxcjBv3Tx6rrv3Z2lhHHKhEHb0RRjATcjAVKV9NZhMajJ4l9pqJ3A4IQrCBl95\n" +
"ux6Xm1oXP0i6aR78cjchsCpcMXdP3WMsvHgTlsZT0RZLFHrvkiNHlPiil4G2/eHk\n" +
"wvT//CrcbO6SmI/zCtMmypuHJqcr+Xb7GPJoa64WoQKBgQDwrfelf3Rdfo9kaK/b\n" +
"rBmbu1++qWpYVPTedQy84DK2p3GE7YfKyI+fhbnw5ol3W1jjfvZCmK/p6eZR4jgy\n" +
"J0KJ76z53T8HoDTF+FTkR55oM3TEM46XzI36RppWP1vgcNHdz3U4DAqkMlAh4lVm\n" +
"3GiKPGX5JHHe7tWz/uZ55Kk58QKBgQDtrkqdSzWlOjvYD4mq4m8jPgS7v3hiHd+1\n" +
"OT8S37zdoT8VVzo2T4SF+fBhI2lWYzpQp2sCjLmCwK9k/Gur55H2kTBTwzlQ6WSL\n" +
"Te9Zj+eoMGklIirA+8YdQHXrO+CCw9BTJAF+c3c3xeUOLXafzyW29bASGfUtA7Ax\n" +
"QAsR+Rr3+wKBgAwfZxrh6ZWP+17+WuVArOWIMZFj7SRX2yGdWa/lxwgmNPSSFkXj\n" +
"hkBttujoY8IsSrTivzqpgCrTCjPTpir4iURzWw4W08bpjd7u3C/HX7Y16Uq8ohEJ\n" +
"T5lslveDJ3iNljSK74eMK7kLg7fBM7YDogxccHJ1IHsvInp3e1pmZxOxAoGAO+bS\n" +
"TUQ4N/UuQezgkF3TDrnBraO67leDGwRbfiE/U0ghQvqh5DA0QSPVzlWDZc9KUitv\n" +
"j8vxsR9o1PW9GS0an17GJEYuetLnkShKK3NWOhBBX6d1yP9rVdH6JhgIJEy/g0Su\n" +
"z7TAFiFc8i7JF8u4QJ05C8bZAMhOLotqftQeVOMCgYAid8aaRvaM2Q8a42Jn6ZTT\n" +
"5ms6AvNr98sv0StnfmNQ+EYXN0bEk2huSW+w2hN34TYYBTjViQmHbhudwwu8lVjE\n" +
"ccDmIXsUFbHVK+kTIpWGGchy5cYPs3k9s1nMR2av0Lojtw9WRY76xRXvN8W6R7Eh\n" +
"wA2ax3+gEEYpGhjM/lO2Lg==\n" +
"-----END PRIVATE KEY-----\n";
var sZ4_CERPEM =
"-----BEGIN CERTIFICATE-----\n" +
"MIIC/zCCAeegAwIBAgIBATANBgkqhkiG9w0BAQUFADAaMQswCQYDVQQGEwJVUzEL\n" +
"MAkGA1UECgwCWjQwHhcNMTMwODI4MTgyODM0WhcNMjMwODI4MTgyODM0WjAaMQsw\n" +
"CQYDVQQGEwJVUzELMAkGA1UECgwCWjQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\n" +
"ggEKAoIBAQDfdOqotHd55SYO0dLz2oXengw/tZ+q3ZmOPeVmMuOMIYO/Cv1wk2U0\n" +
"OK4pug4OBSJPhl09Zs6IwB8NwPOU7EDTgMOcQUYB/6QNCI1J7Zm2oLtuchzz4pIb\n" +
"+o4ZAhVprLhRyvqi8OTKQ7kfGfs5Tuwmn1M/0fQkfzMxADpjOKNgf0uy6lN6utjd\n" +
"TrPKKFUQNdc6/Ty8EeTnQEwUlsT2LAXCfEKxTn5RlRljDztS7Sfgs8VL0FPy1Qi8\n" +
"B+dFcgRYKFrcpsVaZ1lBmXKsXDRu5QR/Rg3f9DRq4GR1sNH8RLY9uApMl2SNz+sR\n" +
"4zRPG85R/se5Q06Gu0BUQ3UPm67ETVZLAgMBAAGjUDBOMB0GA1UdDgQWBBQHZPTE\n" +
"yQVu/0I/3QWhlTyW7WoTzTAfBgNVHSMEGDAWgBQHZPTEyQVu/0I/3QWhlTyW7WoT\n" +
"zTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQDHxqJ9y8alTH7agVMW\n" +
"Zfic/RbrdvHwyq+IOrgDToqyo0w+IZ6BCn9vjv5iuhqu4ForOWDAFpQKZW0DLBJE\n" +
"Qy/7/0+9pk2DPhK1XzdOovlSrkRt+GcEpGnUXnzACXDBbO0+Wrk+hcjEkQRRK1bW\n" +
"2rknARIEJG9GS+pShP9Bq/0BmNsMepdNcBa0z3a5B0fzFyCQoUlX6RTqxRw1h1Qt\n" +
"5F00pfsp7SjXVIvYcewHaNASbto1n5hrSz1VY9hLba11ivL1N4WoWbmzAL6BWabs\n" +
"C2D/MenST2/X6hTKyGXpg3Eg2h3iLvUtwcNny0hRKstc73Jl9xR3qXfXKJH0ThTl\n" +
"q0gq\n" +
"-----END CERTIFICATE-----\n";
// sample_node/_dev/z3.p7s
var hZ3P7S = "308203ce06092a864886f70d010702a08203bf308203bb020101310f300d06096086480165030402010500301206092a864886f70d010701a0050403616161a08201fe308201fa30820163a003020102020101300d06092a864886f70d01010b0500301a310b3009060355040613024a50310b3009060355040a0c025a33301e170d3137303732393036343530345a170d3237303732393036343530345a301a310b3009060355040613024a50310b3009060355040a0c025a3330819f300d06092a864886f70d010101050003818d0030818902818100b0e290513164c116e5bc2c8fd0dc90403e022ee361eefe227e541e9b2a09aa9794f949405a738835831e9d4895623aafe9d9ffb009852df2eb06d5ac5f08378a2129a81ad4b20bdd10df9c66e6e10705d3aaeb134bc790c00b52ed28ffbce6474a9481e367461776d49ffee6fb7d9f36da8a09258215b70ca60269937f9f709b0203010001a350304e301d0603551d0e0416041443983bc00d44b24fa6232c1f39953af0d10d86e7301f0603551d2304183016801443983bc00d44b24fa6232c1f39953af0d10d86e7300c0603551d13040530030101ff300d06092a864886f70d01010b0500038181001d8f34075272864de4616725ce0f9f27fd0cbfebe311d32036603ee996c7146a4ef6424c2f4d57610e92f119d45108817849f2d5f520fa7265057d4e1f1cf8fb43496ab35e9a3df61ab8214178505875b4dd17c8d99df8f01ff12101261e1a711c59eeab961681593ebfc8cee186bb8d12865efc09f4b9d586efcca7c1e5ea913182018d30820189020101301f301a310b3009060355040613024a50310b3009060355040a0c025a33020101300d06096086480165030402010500a081c1301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3137303732393036353831385a302f06092a864886f70d010904312204209834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f03056060b2a864886f70d010910022f31473045304304201608f73494d0e6bbda3432da2b920045fae20d0b2ad45d73f8a11cdfe5d44aa7301f301a310b3009060355040613024a50310b3009060355040a0c025a33020101300d06092a864886f70d01010b05000481804526fd4ce18455902077a9dafa6c028cc26218b400b5ac0f8ec85fef4752b7736c609d19b1d3fb935609681b9cf5b8e473af29d2de8694f6d0518b9ac24ed45954bb1f3eeab70a4624d3c5a4d0311a354d4348547bf4e0202a73c1a80cb334ef99b855c7ea384aa6d57e708c439a93c8859da1ecdaa2c36ea26b7a6b1b7f33e6";
// ======= TEST ===============================================================
test("attr ContentType tSTInfo", function() {
expect(2);
var o = new KJUR.asn1.cms.ContentType({"oid": "1.2.840.113549.1.9.16.1.4"});
equal(o.getEncodedHex(), "301a06092a864886f70d010903310d060b2a864886f70d0109100104", "tstInfo by oid");
var o2 = new KJUR.asn1.cms.ContentType({"name": "tstinfo"});
equal(o2.getEncodedHex(), "301a06092a864886f70d010903310d060b2a864886f70d0109100104", "tstInfo by name");
});
test("attr MessageDigest 01020304abcd", function() {
var o = new KJUR.asn1.cms.MessageDigest({"hex": "01020304abcd"});
equal(o.getEncodedHex(), "301506092a864886f70d0109043108040601020304abcd", "tstInfo");
});
test("attr SigningTime 131231235959Z", function() {
expect(2);
var o1 = new KJUR.asn1.cms.SigningTime({"str": "131231235959Z"});
equal(o1.getEncodedHex(), "301c06092a864886f70d010905310f170d3133313233313233353935395a", "{str:1312...}");
var o2 = new KJUR.asn1.cms.SigningTime({});
equal(o2.getEncodedHex().substr(0, 34),
"301c06092a864886f70d010905310f170d3133313233313233353935395a".substr(0, 34), "{}");
});
test("attr SigningCertificate z4self", function() {
var hExpect = "3050060b2a864886f70d010910020c3141303f303d303b041476c19d787741bdaf76cab1c42d166cb536aa83f83023301ea41c301a310b3009060355040613025553310b3009060355040a0c025a34020101";
var o = new KJUR.asn1.cms.SigningCertificate({array: [sZ4_CERPEM]});
equal(o.getEncodedHex(), hExpect, "by cert");
equal(
ASN1HEX.dump(o.getEncodedHex()),
ASN1HEX.dump(hExpect),
"dump");
});
test("attr SigningCertificateV2 z4self", function() {
var hExpect = "30818b060b2a864886f70d010910022f317c307a30783076300d06096086480165030402030500044026b07a87ff25e74b6a9115ca502a1c913f8f8ee92285418cdfb3c35e910bf30838c98ded14349b8641ce5287616bb0a493e20ee27ac4c377f797dcfcb70fc8c53023301ea41c301a310b3009060355040613025553310b3009060355040a0c025a34020101";
var o = new KJUR.asn1.cms.SigningCertificateV2({array: [sZ4_CERPEM], hashAlg: 'sha512'});
equal(o.getEncodedHex(), hExpect, "by cert sha512");
equal(ASN1HEX.dump(o.getEncodedHex()), ASN1HEX.dump(hExpect), "dump");
});
test("IssuerSerial /C=US/O=T1 3", function() {
var o = new KJUR.asn1.cms.IssuerSerial({"issuer": {"str": "/C=US/O=T1"},
"serial": {"int": 3}});
equal(
o.getEncodedHex(),
"3023301ea41c301a310b3009060355040613025553310b3009060355040a0c025431020103",
"by issuer and serial");
//equal(ASN1HEX.dump(o.getEncodedHex()), null, "IGNORE dump check only");
var o2 = new KJUR.asn1.cms.IssuerSerial({cert: sZ4_CERPEM});
equal(o2.getEncodedHex(),
"3023301ea41c301a310b3009060355040613025553310b3009060355040a0c025a34020101",
"by cert");
//equal(ASN1HEX.dump(o2.getEncodedHex()), null, "IGNORE dump check only");
});
test("IssuerAndSerialNumber /C=US/O=T1 3", function() {
var o = new KJUR.asn1.cms.IssuerAndSerialNumber({"issuer": {"str": "/C=US/O=T1"},
"serial": {"int": 3}});
equal(o.getEncodedHex(), "301f301a310b3009060355040613025553310b3009060355040a0c025431020103", "by issuer and serial");
var o2 = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: sZ4_CERPEM});
equal(o2.getEncodedHex(), "301f301a310b3009060355040613025553310b3009060355040a0c025a34020101", "by cert");
});
test("AttributeList/1 sorted", function() {
var a1 = new KJUR.asn1.cms.ContentType({"oid": "1.2.840.113549.1.9.16.1.4"});
var a2 = new KJUR.asn1.cms.MessageDigest({"hex": "0102030405060708090001020304050607080900"});
expect(3);
var o1 = new KJUR.asn1.cms.AttributeList();
o1.add(a1);
o1.add(a2);
equal(o1.getEncodedHex(), "3141301a06092a864886f70d010903310d060b2a864886f70d0109100104302306092a864886f70d010904311604140102030405060708090001020304050607080900", "[a1,a2], sortFlag = true");
var o2 = new KJUR.asn1.cms.AttributeList();
o2.add(a2);
o2.add(a1);
equal(o2.getEncodedHex(), "3141301a06092a864886f70d010903310d060b2a864886f70d0109100104302306092a864886f70d010904311604140102030405060708090001020304050607080900", "[a2,a1], sortFlag = true");
var o3 = new KJUR.asn1.cms.AttributeList();
o3.sortFlag = false;
o3.add(a2);
o3.add(a1);
equal(o3.getEncodedHex(), "3141302306092a864886f70d010904311604140102030405060708090001020304050607080900301a06092a864886f70d010903310d060b2a864886f70d0109100104", "[a2,a1], sortFlag = false");
});
test("SignerInfo/1", function() {
var o = new KJUR.asn1.cms.SignerInfo();
o.dSignerIdentifier =
new KJUR.asn1.cms.IssuerAndSerialNumber({issuer: {str: '/C=US/O=T1'},
serial: {int: 1}});
o.dDigestAlgorithm = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'sha1'});
o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.7.1'})); // data
o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0'}));
o.dSigAlg = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'SHA1withRSA'});
o.dSig = new KJUR.asn1.DEROctetString({hex: 'b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8'});
equal(o.getEncodedHex(), "3081a1020101301f301a310b3009060355040613025553310b3009060355040a0c025431020101300906052b0e03021a0500a03f301806092a864886f70d010903310b06092a864886f70d010701302306092a864886f70d01090431160414a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0300d06092a864886f70d01010505000420b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8", "si1");
});
test("SignerInfo/2 sign(sZ4PRV), setSignerIdentifier(sZ4CER)", function() {
var o = new KJUR.asn1.cms.SignerInfo();
o.setSignerIdentifier(sZ4_CERPEM);
o.dDigestAlgorithm = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'sha1'});
o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.7.1'})); // data
o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0'}));
o.sign(sZ4_PRVP8PPEM, "SHA1withRSA");
equal(o.getEncodedHex(), "30820183020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300906052b0e03021a0500a03f301806092a864886f70d010903310b06092a864886f70d010701302306092a864886f70d01090431160414a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0300d06092a864886f70d010105050004820100dddd5f91e66958996fa1783907bbe97dcb1b1592a4513b0fd6714875dce9957641c4c73cc8d87b9243c83b8f0499fa8392d43721eece8c7aa12e991db721268c290b3fbe930934ecf9c512db5084d55605e6e46c0beb88e784d3bbb60fc7ebaa16e2accdc9d8bef1a1df7c59d7efe2abb0fad8578019f51bea27e205207d42d96c21d19eb276b1744ea751e8357053c6b84452ff97fa4b74b8d3b923edfb2d5a1a5f5ba3e2ecdc63d82f95f416b70e85f2d72acffaea5e16782fa2e202649ecc6c3cc9517b6352500c366a76d71fdbfc9e0195bbef142557d1e211d75a5362d0409002acb576dee3e9f26336a3ebcbfe2642a0fd65c9a22b826fca791b253bdf", "si2");
});
test("EncapsulatedContentInfo", function() {
expect(5);
var o1 = new KJUR.asn1.cms.EncapsulatedContentInfo();
o1.setContentValueHex('616161');
equal(o1.getEncodedHex(), "301206092a864886f70d010701a0050403616161", "setContentValueHex(616161)");
var o2 = new KJUR.asn1.cms.EncapsulatedContentInfo();
o2.setContentValueStr('aaa');
equal(o2.getEncodedHex(), "301206092a864886f70d010701a0050403616161", "setContentValueStr(aaa)");
var o3 = new KJUR.asn1.cms.EncapsulatedContentInfo();
o3.setContentValueStr('aaa');
o3.isDetached = true;
equal(o3.getEncodedHex(), "300b06092a864886f70d010701", "setContentValueStr(aaa) isDetached");
var o4 = new KJUR.asn1.cms.EncapsulatedContentInfo();
o4.setContentType('tstinfo');
o4.setContentValueHex('3006020101020102');
equal(o4.getEncodedHex(), "3019060b2a864886f70d0109100104a00a04083006020101020102",
"setContentValueHex(3006020101020102) tstInfo");
var o5 = new KJUR.asn1.cms.EncapsulatedContentInfo();
o5.setContentValue({str: 'aaa'});
equal(o5.getEncodedHex(), "301206092a864886f70d010701a0050403616161", "setContentValue({str:aaa})");
});
test("ContentInfo/1", function() {
var nA = KJUR.asn1;
var seq = new nA.DERSequence({array: [new nA.DERInteger({int: 1}),
new nA.DERInteger({int: 2})]});
var o = new KJUR.asn1.cms.ContentInfo({type: 'signed-data', obj: seq});
equal(o.getEncodedHex(), "301506092a864886f70d010702a0083006020101020102");
});
test("SignedData/1", function() {
var o = new KJUR.asn1.cms.SignedData();
o.dEncapContentInfo.setContentValueHex('616161');
o.digestAlgNameList = ['sha1'];
o.signerInfoList[0].dSignerIdentifier =
new KJUR.asn1.cms.IssuerAndSerialNumber({issuer: {str: '/C=US/O=T1'},
serial: {int: 1}});
o.signerInfoList[0].dDigestAlgorithm = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'sha1'});
o.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.7.1'})); // data
o.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0'}));
o.signerInfoList[0].dSigAlg = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'SHA1withRSA'});
o.signerInfoList[0].dSig = new KJUR.asn1.DEROctetString({hex: 'b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8'});
equal(o.getEncodedHex(), "3081cb020101310b300906052b0e03021a0500301206092a864886f70d010701a00504036161613181a43081a1020101301f301a310b3009060355040613025553310b3009060355040a0c025431020101300906052b0e03021a0500a03f301806092a864886f70d010903310b06092a864886f70d010701302306092a864886f70d01090431160414a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0300d06092a864886f70d01010505000420b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8", "sd1");
});
test("SignedData/2 getContentInfoEncodedHex", function() {
var o = new KJUR.asn1.cms.SignedData();
o.dEncapContentInfo.setContentValueHex('616161');
o.digestAlgNameList = ['sha1'];
o.signerInfoList[0].dSignerIdentifier =
new KJUR.asn1.cms.IssuerAndSerialNumber({issuer: {str: '/C=US/O=T1'},
serial: {int: 1}});
o.signerInfoList[0].dDigestAlgorithm = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'sha1'});
o.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.7.1'})); // data
o.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0'}));
o.signerInfoList[0].dSigAlg = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'SHA1withRSA'});
o.signerInfoList[0].dSig = new KJUR.asn1.DEROctetString({hex: 'b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8'});
equal(o.getContentInfoEncodedHex(), "3081dc06092a864886f70d010702a081ce3081cb020101310b300906052b0e03021a0500301206092a864886f70d010701a00504036161613181a43081a1020101301f301a310b3009060355040613025553310b3009060355040a0c025431020101300906052b0e03021a0500a03f301806092a864886f70d010903310b06092a864886f70d010701302306092a864886f70d01090431160414a1a2a3a4a5a6a7a8a9a0a1a2a3a4a5a6a7a8a9a0300d06092a864886f70d01010505000420b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8b1b2b3b4b5b6b7b8", "sd1");
});
test("SignedData total test", function() {
var nC = KJUR.asn1.cms;
var sd = new nC.SignedData();
sd.dEncapContentInfo.setContentValue({str: "jsrsasign"});
sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
eciObj: sd.dEncapContentInfo,
hashAlg: 'sha256'});
sd.signerInfoList[0].dSignedAttrs.add(new nC.SigningTime({str: '131231235959Z'}));
//sd.signerInfoList[0].dSignedAttrs.add(new nC.SigningTime());
sd.signerInfoList[0].setSignerIdentifier(sZ4_CERPEM);
sd.signerInfoList[0].sign(sZ4_PRVP8PPEM, "SHA256withRSA");
equal(sd.getContentInfoEncodedHex(), "308201fa06092a864886f70d010702a08201eb308201e7020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676e318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
});
test("SignedData total test/2 addCertificateByPEM", function() {
var nC = KJUR.asn1.cms;
var sd = new nC.SignedData();
sd.dEncapContentInfo.setContentValue({str: "jsrsasign"});
sd.addCertificatesByPEM(sZ4_CERPEM);
sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
eciObj: sd.dEncapContentInfo,
hashAlg: 'sha256'});
sd.signerInfoList[0].dSignedAttrs.add(new nC.SigningTime({str: '131231235959Z'}));
//sd.signerInfoList[0].dSignedAttrs.add(new nC.SigningTime());
sd.signerInfoList[0].setSignerIdentifier(sZ4_CERPEM);
sd.signerInfoList[0].sign(sZ4_PRVP8PPEM, "SHA256withRSA");
equal(sd.getContentInfoEncodedHex(), "3082050106092a864886f70d010702a08204f2308204ee020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676ea0820303308202ff308201e7a003020102020101300d06092a864886f70d0101050500301a310b3009060355040613025553310b3009060355040a0c025a34301e170d3133303832383138323833345a170d3233303832383138323833345a301a310b3009060355040613025553310b3009060355040a0c025a3430820122300d06092a864886f70d01010105000382010f003082010a0282010100df74eaa8b47779e5260ed1d2f3da85de9e0c3fb59faadd998e3de56632e38c2183bf0afd7093653438ae29ba0e0e05224f865d3d66ce88c01f0dc0f394ec40d380c39c414601ffa40d088d49ed99b6a0bb6e721cf3e2921bfa8e19021569acb851cafaa2f0e4ca43b91f19fb394eec269f533fd1f4247f3331003a6338a3607f4bb2ea537abad8dd4eb3ca28551035d73afd3cbc11e4e7404c1496c4f62c05c27c42b14e7e519519630f3b52ed27e0b3c54bd053f2d508bc07e745720458285adca6c55a6759419972ac5c346ee5047f460ddff4346ae06475b0d1fc44b63db80a4c97648dcfeb11e3344f1bce51fec7b9434e86bb405443750f9baec44d564b0203010001a350304e301d0603551d0e041604140764f4c4c9056eff423fdd05a1953c96ed6a13cd301f0603551d230418301680140764f4c4c9056eff423fdd05a1953c96ed6a13cd300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100c7c6a27dcbc6a54c7eda81531665f89cfd16eb76f1f0caaf883ab8034e8ab2a34c3e219e810a7f6f8efe62ba1aaee05a2b3960c016940a656d032c1244432ffbff4fbda64d833e12b55f374ea2f952ae446df86704a469d45e7cc00970c16ced3e5ab93e85c8c49104512b56d6dab927011204246f464bea5284ff41abfd0198db0c7a974d7016b4cf76b90747f3172090a14957e914eac51c3587542de45d34a5fb29ed28d7548bd871ec0768d0126eda359f986b4b3d5563d84b6dad758af2f53785a859b9b300be8159a6ec0b60ff31e9d24f6fd7ea14cac865e9837120da1de22ef52dc1c367cb48512acb5cef7265f71477a977d72891f44e14e5ab482a318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
});
test("CMSUtil.newSignedData/1", function() {
var sd = KJUR.asn1.cms.CMSUtil.newSignedData(
{
content: {str: "jsrsasign"},
signerInfos: [{
hashAlg: 'sha256',
sAttr: {
SigningTime: {str: '131231235959Z'}
},
signerCert: sZ4_CERPEM,
sigAlg: 'SHA256withRSA',
signerPrvKey: sZ4_PRVP8PPEM
}]
}
);
equal(sd.getContentInfoEncodedHex(), "308201fa06092a864886f70d010702a08201eb308201e7020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676e318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
});
test("CMSUtil.newSignedData/2 certificate added", function() {
var sd = KJUR.asn1.cms.CMSUtil.newSignedData(
{
content: {str: "jsrsasign"},
certs: [sZ4_CERPEM],
signerInfos: [{
hashAlg: 'sha256',
sAttr: {
SigningTime: {str: '131231235959Z'}
},
signerCert: sZ4_CERPEM,
sigAlg: 'SHA256withRSA',
signerPrvKey: sZ4_PRVP8PPEM
}]
}
);
equal(sd.getContentInfoEncodedHex(), "3082050106092a864886f70d010702a08204f2308204ee020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676ea0820303308202ff308201e7a003020102020101300d06092a864886f70d0101050500301a310b3009060355040613025553310b3009060355040a0c025a34301e170d3133303832383138323833345a170d3233303832383138323833345a301a310b3009060355040613025553310b3009060355040a0c025a3430820122300d06092a864886f70d01010105000382010f003082010a0282010100df74eaa8b47779e5260ed1d2f3da85de9e0c3fb59faadd998e3de56632e38c2183bf0afd7093653438ae29ba0e0e05224f865d3d66ce88c01f0dc0f394ec40d380c39c414601ffa40d088d49ed99b6a0bb6e721cf3e2921bfa8e19021569acb851cafaa2f0e4ca43b91f19fb394eec269f533fd1f4247f3331003a6338a3607f4bb2ea537abad8dd4eb3ca28551035d73afd3cbc11e4e7404c1496c4f62c05c27c42b14e7e519519630f3b52ed27e0b3c54bd053f2d508bc07e745720458285adca6c55a6759419972ac5c346ee5047f460ddff4346ae06475b0d1fc44b63db80a4c97648dcfeb11e3344f1bce51fec7b9434e86bb405443750f9baec44d564b0203010001a350304e301d0603551d0e041604140764f4c4c9056eff423fdd05a1953c96ed6a13cd301f0603551d230418301680140764f4c4c9056eff423fdd05a1953c96ed6a13cd300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100c7c6a27dcbc6a54c7eda81531665f89cfd16eb76f1f0caaf883ab8034e8ab2a34c3e219e810a7f6f8efe62ba1aaee05a2b3960c016940a656d032c1244432ffbff4fbda64d833e12b55f374ea2f952ae446df86704a469d45e7cc00970c16ced3e5ab93e85c8c49104512b56d6dab927011204246f464bea5284ff41abfd0198db0c7a974d7016b4cf76b90747f3172090a14957e914eac51c3587542de45d34a5fb29ed28d7548bd871ec0768d0126eda359f986b4b3d5563d84b6dad758af2f53785a859b9b300be8159a6ec0b60ff31e9d24f6fd7ea14cac865e9837120da1de22ef52dc1c367cb48512acb5cef7265f71477a977d72891f44e14e5ab482a318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
});
test("(19) CMSUtil.newSignedData/3 2+signcertv2,sigpol added", function() {
var hExpect = "3082059006092a864886f70d010702a08205813082057d020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676ea0820303308202ff308201e7a003020102020101300d06092a864886f70d0101050500301a310b3009060355040613025553310b3009060355040a0c025a34301e170d3133303832383138323833345a170d3233303832383138323833345a301a310b3009060355040613025553310b3009060355040a0c025a3430820122300d06092a864886f70d01010105000382010f003082010a0282010100df74eaa8b47779e5260ed1d2f3da85de9e0c3fb59faadd998e3de56632e38c2183bf0afd7093653438ae29ba0e0e05224f865d3d66ce88c01f0dc0f394ec40d380c39c414601ffa40d088d49ed99b6a0bb6e721cf3e2921bfa8e19021569acb851cafaa2f0e4ca43b91f19fb394eec269f533fd1f4247f3331003a6338a3607f4bb2ea537abad8dd4eb3ca28551035d73afd3cbc11e4e7404c1496c4f62c05c27c42b14e7e519519630f3b52ed27e0b3c54bd053f2d508bc07e745720458285adca6c55a6759419972ac5c346ee5047f460ddff4346ae06475b0d1fc44b63db80a4c97648dcfeb11e3344f1bce51fec7b9434e86bb405443750f9baec44d564b0203010001a350304e301d0603551d0e041604140764f4c4c9056eff423fdd05a1953c96ed6a13cd301f0603551d230418301680140764f4c4c9056eff423fdd05a1953c96ed6a13cd300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100c7c6a27dcbc6a54c7eda81531665f89cfd16eb76f1f0caaf883ab8034e8ab2a34c3e219e810a7f6f8efe62ba1aaee05a2b3960c016940a656d032c1244432ffbff4fbda64d833e12b55f374ea2f952ae446df86704a469d45e7cc00970c16ced3e5ab93e85c8c49104512b56d6dab927011204246f464bea5284ff41abfd0198db0c7a974d7016b4cf76b90747f3172090a14957e914eac51c3587542de45d34a5fb29ed28d7548bd871ec0768d0126eda359f986b4b3d5563d84b6dad758af2f53785a859b9b300be8159a6ec0b60ff31e9d24f6fd7ea14cac865e9837120da1de22ef52dc1c367cb48512acb5cef7265f71477a977d72891f44e14e5ab482a3182024430820240020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a081f7301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302e060b2a864886f70d010910020f311f301d06042a0304053015300906052b0e03021a05000408b1b2b3b4b5b6b7b8302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4305c060b2a864886f70d010910022f314d304b304930470420c355dc4ee1dca2a95053ed90d27ff13025c887824da7d7cc83348ab2a0e944423023301ea41c301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06092a864886f70d01010b05000482010013c73a7f055ba1e242d300fc9ceae61a6fa56ceea05b5ae2fc2b4508812cecbf07a09ce4670622f58aa89d4465a705dad2c2e284651d0c5add679257ac8f656a661e8dc902c21cab8cb9886333bf427839ce56a3cd71284731e8da566aa543ad2d932a96ff9087775e4f6e2b0f04c7d4d9e8b921c2fe024ba0c9efa8279703e4a3c9baaeb1c9a5f9e10672a81d058b64a81208f5e88fe8b038e648d65a0474283d0660c46fb7636d085abc2d0e39f74e8ad50a9bb233fa43adddf852d23dd79bd0819b68225d3ee5ecfb0eb2a54c4af859d1bdc350443221db5189a5a8b9c92766dae014ec6badb0abcf2e806c071c6a9f7e3f651f39eda28dc5e509516cb359";
var param = {
content: {str: "jsrsasign"},
certs: [sZ4_CERPEM],
signerInfos: [{
hashAlg: 'sha256',
sAttr: {
SigningTime: {str: '131231235959Z'},
SigningCertificateV2: {array: [sZ4_CERPEM]},
SignaturePolicyIdentifier: {
oid: '1.2.3.4.5',
hash: {alg: 'sha1', hash: 'b1b2b3b4b5b6b7b8'}
},
},
signerCert: sZ4_CERPEM,
sigAlg: 'SHA256withRSA',
signerPrvKey: sZ4_PRVP8PPEM
}]
};
var sd = KJUR.asn1.cms.CMSUtil.newSignedData(param);
equal(sd.getContentInfoEncodedHex(), hExpect, "by param");
equal(
ASN1HEX.dump(sd.getContentInfoEncodedHex()),
ASN1HEX.dump(hExpect),
"dump");
});
test("CMSUtil.newSignedData/4 not detached signature (default)", function() {
var sd = KJUR.asn1.cms.CMSUtil.newSignedData(
{
content: {str: "jsrsasign"},
signerInfos: [{
hashAlg: 'sha256',
sAttr: {
SigningTime: {str: '131231235959Z'}
},
signerCert: sZ4_CERPEM,
sigAlg: 'SHA256withRSA',
signerPrvKey: sZ4_PRVP8PPEM
}]
}
);
equal(sd.getContentInfoEncodedHex(), "308201fa06092a864886f70d010702a08201eb308201e7020101310f300d06096086480165030402010500301806092a864886f70d010701a00b04096a737273617369676e318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
equal(sd.dEncapContentInfo.isDetached, false);
});
test("CMSUtil.newSignedData/5 detached signature", function() {
var sd = KJUR.asn1.cms.CMSUtil.newSignedData(
{
content: {str: "jsrsasign"},
detached: true,
signerInfos: [{
hashAlg: 'sha256',
sAttr: {
SigningTime: {str: '131231235959Z'}
},
signerCert: sZ4_CERPEM,
sigAlg: 'SHA256withRSA',
signerPrvKey: sZ4_PRVP8PPEM
}]
}
);
equal(sd.getContentInfoEncodedHex(), "308201ed06092a864886f70d010702a08201de308201da020101310f300d06096086480165030402010500300b06092a864886f70d010701318201b5308201b1020101301f301a310b3009060355040613025553310b3009060355040a0c025a34020101300d06096086480165030402010500a069301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3133313233313233353935395a302f06092a864886f70d0109043122042084c24dd1d9f56eb3a07ae4a23445add4facbaed78c89475296ab7954284d9cd4300d06092a864886f70d01010b0500048201002e102927a557ecef796fc36b5d858207e93927343361fe5136ce34e645347765ac5de316190ad57bc96bfdff34d7829c7cb6280470a32c3a3965149aed9f1032f9d4f92cecb5038c19b6f0b0f894e730e138cf2f5a7ce1f239535b829977ce1ad4b2fcf226953edecaabf6a5b7fcd179a5e6bd1b44c1f101341a4ac38f7d2d086c2d00cc3c6ad7fb07525cf7cb766420e5f628c36ddaefb708701666a301bc8f1b9c24ca0e50bf4626648d15b2c9eee1b87453f15ca27f3e0580095947a58bcc3ff685b7c4c2cedb3aefe77a87d8ed57eab22a082220e909088cfb18f951c65a9cd39213f9a7e3a81b13b6137f0283da99e0302a9c27238099e31cb5656e3200", "");
equal(sd.dEncapContentInfo.isDetached, true);
});
test("CMSUtil.verifySignedData", function() {
var result = KJUR.asn1.cms.CMSUtil.verifySignedData({cms: hZ3P7S});
equal(result.isValid, true, "isValid");
equal(result.parse.cmsType, "signedData", "cmsType");
equal(result.parse.econtent, "616161", "econtent");
equal(result.parse.certsIdx, 126, "certsIdx");
equal(result.parse.revinfosIdx, undefined, "revinfosIdx");
equal(result.parse.signerinfosIdx, 1154, "signerinfosIdx");
//deepEqual(result.parse.signerInfos, "", "signerInfos");
//deepEqual(result, "", "result");
});
});
-->
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
<div>
QUnit TEST
<a href="qunit-do-asn1.html">asn1</a> |
<a href="qunit-do-asn1x509.html">asn1x509</a> |
<a href="qunit-do-asn1cms.html">asn1cms</a> |
<a href="qunit-do-asn1tsp.html">asn1tsp</a> |
<a href="../api/index.html">APIDOCS</a> |
</div>
</body>
</html>