pdfjs-dist 2.0.943 → 2.4.456
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/CODE_OF_CONDUCT.md +15 -0
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8286 -14230
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +25500 -26628
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +2887 -4094
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +855 -778
- package/lib/core/arithmetic_decoder.js +325 -311
- package/lib/core/bidi.js +117 -50
- package/lib/core/ccitt.js +251 -89
- package/lib/core/ccitt_stream.js +26 -16
- package/lib/core/cff_parser.js +525 -197
- package/lib/core/charsets.js +6 -5
- package/lib/core/chunked_stream.js +541 -406
- package/lib/core/cmap.js +368 -253
- package/lib/core/colorspace.js +781 -800
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +609 -422
- package/lib/core/document.js +649 -481
- package/lib/core/encodings.js +33 -24
- package/lib/core/evaluator.js +1471 -736
- package/lib/core/font_renderer.js +289 -149
- package/lib/core/fonts.js +1067 -413
- package/lib/core/function.js +517 -287
- package/lib/core/glyphlist.js +4529 -4527
- package/lib/core/image.js +232 -114
- package/lib/core/image_utils.js +94 -0
- package/lib/core/jbig2.js +711 -342
- package/lib/core/jbig2_stream.js +31 -19
- package/lib/core/jpeg_stream.js +151 -26
- package/lib/core/jpg.js +433 -181
- package/lib/core/jpx.js +551 -143
- package/lib/core/jpx_stream.js +40 -28
- package/lib/core/metrics.js +2931 -2931
- package/lib/core/murmurhash3.js +104 -97
- package/lib/core/obj.js +1561 -1053
- package/lib/core/operator_list.js +192 -64
- package/lib/core/parser.js +1162 -864
- package/lib/core/pattern.js +224 -75
- package/lib/core/pdf_manager.js +154 -285
- package/lib/core/primitives.js +145 -69
- package/lib/core/ps_parser.js +212 -162
- package/lib/core/standard_fonts.js +245 -244
- package/lib/core/stream.js +353 -81
- package/lib/core/type1_parser.js +218 -68
- package/lib/core/unicode.js +1682 -1655
- package/lib/core/worker.js +233 -302
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +808 -862
- package/lib/display/api.js +1778 -1462
- package/lib/display/api_compatibility.js +14 -9
- package/lib/display/canvas.js +463 -140
- package/lib/display/content_disposition.js +86 -58
- package/lib/display/display_utils.js +524 -0
- package/lib/display/fetch_stream.js +202 -274
- package/lib/display/font_loader.js +311 -333
- package/lib/display/metadata.js +98 -88
- package/lib/display/network.js +343 -347
- package/lib/display/network_utils.js +46 -26
- package/lib/display/node_stream.js +326 -404
- package/lib/display/pattern_helper.js +168 -69
- package/lib/display/svg.js +1296 -885
- package/lib/display/text_layer.js +229 -103
- package/lib/display/transport_stream.js +290 -250
- package/lib/display/webgl.js +116 -83
- package/lib/display/worker_options.js +6 -5
- package/lib/display/xml_parser.js +358 -337
- package/lib/examples/node/domstubs.js +95 -39
- package/lib/pdf.js +49 -31
- package/lib/pdf.worker.js +7 -5
- package/lib/shared/compatibility.js +3 -145
- package/lib/shared/is_node.js +8 -7
- package/lib/shared/message_handler.js +367 -314
- package/lib/shared/util.js +421 -415
- package/lib/test/unit/annotation_spec.js +1570 -690
- package/lib/test/unit/api_spec.js +855 -493
- package/lib/test/unit/bidi_spec.js +12 -12
- package/lib/test/unit/cff_parser_spec.js +88 -61
- package/lib/test/unit/clitests_helper.js +9 -12
- package/lib/test/unit/cmap_spec.js +140 -88
- package/lib/test/unit/colorspace_spec.js +204 -152
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +194 -182
- package/lib/test/unit/custom_spec.js +50 -64
- package/lib/test/unit/display_svg_spec.js +53 -38
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +17 -22
- package/lib/test/unit/encodings_spec.js +15 -57
- package/lib/test/unit/evaluator_spec.js +90 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +219 -205
- package/lib/test/unit/jasmine-boot.js +68 -39
- package/lib/test/unit/message_handler_spec.js +187 -160
- package/lib/test/unit/metadata_spec.js +87 -34
- package/lib/test/unit/murmurhash3_spec.js +13 -13
- package/lib/test/unit/network_spec.js +26 -59
- package/lib/test/unit/network_utils_spec.js +187 -121
- package/lib/test/unit/node_stream_spec.js +98 -90
- package/lib/test/unit/parser_spec.js +173 -131
- package/lib/test/unit/pdf_find_controller_spec.js +148 -67
- package/lib/test/unit/pdf_find_utils_spec.js +35 -34
- package/lib/test/unit/pdf_history_spec.js +45 -33
- package/lib/test/unit/primitives_spec.js +161 -126
- package/lib/test/unit/stream_spec.js +22 -15
- package/lib/test/unit/test_utils.js +149 -98
- package/lib/test/unit/testreporter.js +36 -18
- package/lib/test/unit/type1_parser_spec.js +46 -44
- package/lib/test/unit/ui_utils_spec.js +388 -372
- package/lib/test/unit/unicode_spec.js +49 -46
- package/lib/test/unit/util_spec.js +144 -248
- package/lib/web/annotation_layer_builder.js +75 -95
- package/lib/web/app.js +1538 -1147
- package/lib/web/app_options.js +116 -104
- package/lib/web/base_viewer.js +950 -775
- package/lib/web/chromecom.js +217 -225
- package/lib/web/debugger.js +236 -148
- package/lib/web/download_manager.js +50 -50
- package/lib/web/firefox_print_service.js +51 -33
- package/lib/web/firefoxcom.js +225 -352
- package/lib/web/genericcom.js +30 -93
- package/lib/web/genericl10n.js +26 -143
- package/lib/web/grab_to_pan.js +57 -33
- package/lib/web/interfaces.js +105 -232
- package/lib/web/overlay_manager.js +73 -227
- package/lib/web/password_prompt.js +44 -62
- package/lib/web/pdf_attachment_viewer.js +118 -123
- package/lib/web/pdf_cursor_tools.js +89 -93
- package/lib/web/pdf_document_properties.js +242 -281
- package/lib/web/pdf_find_bar.js +157 -163
- package/lib/web/pdf_find_controller.js +598 -454
- package/lib/web/pdf_find_utils.js +32 -16
- package/lib/web/pdf_history.js +481 -355
- package/lib/web/pdf_link_service.js +355 -323
- package/lib/web/pdf_outline_viewer.js +167 -152
- package/lib/web/pdf_page_view.js +511 -457
- package/lib/web/pdf_presentation_mode.js +347 -335
- package/lib/web/pdf_print_service.js +133 -103
- package/lib/web/pdf_rendering_queue.js +98 -100
- package/lib/web/pdf_sidebar.js +323 -299
- package/lib/web/pdf_sidebar_resizer.js +107 -108
- package/lib/web/pdf_single_page_viewer.js +94 -146
- package/lib/web/pdf_thumbnail_view.js +319 -269
- package/lib/web/pdf_thumbnail_viewer.js +219 -199
- package/lib/web/pdf_viewer.component.js +111 -32
- package/lib/web/pdf_viewer.js +61 -101
- package/lib/web/preferences.js +87 -272
- package/lib/web/secondary_toolbar.js +207 -220
- package/lib/web/text_layer_builder.js +322 -322
- package/lib/web/toolbar.js +227 -180
- package/lib/web/ui_utils.js +476 -421
- package/lib/web/view_history.js +59 -208
- package/lib/web/viewer_compatibility.js +9 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +36 -22
- package/web/pdf_viewer.js +4407 -4516
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/display/dom_utils.js +0 -441
- package/lib/shared/streams_polyfill.js +0 -39
- package/lib/shared/url_polyfill.js +0 -50
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/web/dom_events.js +0 -140
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,256 +19,259 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
|
-
var _crypto = require(
|
24
|
+
var _crypto = require("../../core/crypto.js");
|
25
25
|
|
26
|
-
var _primitives = require(
|
26
|
+
var _primitives = require("../../core/primitives.js");
|
27
27
|
|
28
|
-
var _util = require(
|
28
|
+
var _util = require("../../shared/util.js");
|
29
29
|
|
30
|
-
describe(
|
30
|
+
describe("crypto", function () {
|
31
31
|
function hex2binary(s) {
|
32
|
-
var digits =
|
32
|
+
var digits = "0123456789ABCDEF";
|
33
33
|
s = s.toUpperCase();
|
34
34
|
var n = s.length >> 1,
|
35
35
|
i,
|
36
36
|
j;
|
37
37
|
var result = new Uint8Array(n);
|
38
|
+
|
38
39
|
for (i = 0, j = 0; i < n; ++i) {
|
39
40
|
var d1 = s.charAt(j++);
|
40
41
|
var d2 = s.charAt(j++);
|
41
42
|
var value = digits.indexOf(d1) << 4 | digits.indexOf(d2);
|
42
43
|
result[i] = value;
|
43
44
|
}
|
45
|
+
|
44
46
|
return result;
|
45
47
|
}
|
46
|
-
|
47
|
-
|
48
|
+
|
49
|
+
describe("calculateMD5", function () {
|
50
|
+
it("should pass RFC 1321 test #1", function () {
|
48
51
|
var input, result, expected;
|
49
|
-
input = (0, _util.stringToBytes)(
|
52
|
+
input = (0, _util.stringToBytes)("");
|
50
53
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
51
|
-
expected = hex2binary(
|
54
|
+
expected = hex2binary("d41d8cd98f00b204e9800998ecf8427e");
|
52
55
|
expect(result).toEqual(expected);
|
53
56
|
});
|
54
|
-
it(
|
57
|
+
it("should pass RFC 1321 test #2", function () {
|
55
58
|
var input, result, expected;
|
56
|
-
input = (0, _util.stringToBytes)(
|
59
|
+
input = (0, _util.stringToBytes)("a");
|
57
60
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
58
|
-
expected = hex2binary(
|
61
|
+
expected = hex2binary("0cc175b9c0f1b6a831c399e269772661");
|
59
62
|
expect(result).toEqual(expected);
|
60
63
|
});
|
61
|
-
it(
|
64
|
+
it("should pass RFC 1321 test #3", function () {
|
62
65
|
var input, result, expected;
|
63
|
-
input = (0, _util.stringToBytes)(
|
66
|
+
input = (0, _util.stringToBytes)("abc");
|
64
67
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
65
|
-
expected = hex2binary(
|
68
|
+
expected = hex2binary("900150983cd24fb0d6963f7d28e17f72");
|
66
69
|
expect(result).toEqual(expected);
|
67
70
|
});
|
68
|
-
it(
|
71
|
+
it("should pass RFC 1321 test #4", function () {
|
69
72
|
var input, result, expected;
|
70
|
-
input = (0, _util.stringToBytes)(
|
73
|
+
input = (0, _util.stringToBytes)("message digest");
|
71
74
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
72
|
-
expected = hex2binary(
|
75
|
+
expected = hex2binary("f96b697d7cb7938d525a2f31aaf161d0");
|
73
76
|
expect(result).toEqual(expected);
|
74
77
|
});
|
75
|
-
it(
|
78
|
+
it("should pass RFC 1321 test #5", function () {
|
76
79
|
var input, result, expected;
|
77
|
-
input = (0, _util.stringToBytes)(
|
80
|
+
input = (0, _util.stringToBytes)("abcdefghijklmnopqrstuvwxyz");
|
78
81
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
79
|
-
expected = hex2binary(
|
82
|
+
expected = hex2binary("c3fcd3d76192e4007dfb496cca67e13b");
|
80
83
|
expect(result).toEqual(expected);
|
81
84
|
});
|
82
|
-
it(
|
85
|
+
it("should pass RFC 1321 test #6", function () {
|
83
86
|
var input, result, expected;
|
84
|
-
input = (0, _util.stringToBytes)(
|
87
|
+
input = (0, _util.stringToBytes)("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
85
88
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
86
|
-
expected = hex2binary(
|
89
|
+
expected = hex2binary("d174ab98d277d9f5a5611c2c9f419d9f");
|
87
90
|
expect(result).toEqual(expected);
|
88
91
|
});
|
89
|
-
it(
|
92
|
+
it("should pass RFC 1321 test #7", function () {
|
90
93
|
var input, result, expected;
|
91
|
-
input = (0, _util.stringToBytes)(
|
94
|
+
input = (0, _util.stringToBytes)("123456789012345678901234567890123456789012345678" + "90123456789012345678901234567890");
|
92
95
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
93
|
-
expected = hex2binary(
|
96
|
+
expected = hex2binary("57edf4a22be3c955ac49da2e2107b67a");
|
94
97
|
expect(result).toEqual(expected);
|
95
98
|
});
|
96
99
|
});
|
97
|
-
describe(
|
98
|
-
it(
|
100
|
+
describe("ARCFourCipher", function () {
|
101
|
+
it("should pass test #1", function () {
|
99
102
|
var key, input, result, expected, cipher;
|
100
|
-
key = hex2binary(
|
101
|
-
input = hex2binary(
|
103
|
+
key = hex2binary("0123456789abcdef");
|
104
|
+
input = hex2binary("0123456789abcdef");
|
102
105
|
cipher = new _crypto.ARCFourCipher(key);
|
103
106
|
result = cipher.encryptBlock(input);
|
104
|
-
expected = hex2binary(
|
107
|
+
expected = hex2binary("75b7878099e0c596");
|
105
108
|
expect(result).toEqual(expected);
|
106
109
|
});
|
107
|
-
it(
|
110
|
+
it("should pass test #2", function () {
|
108
111
|
var key, input, result, expected, cipher;
|
109
|
-
key = hex2binary(
|
110
|
-
input = hex2binary(
|
112
|
+
key = hex2binary("0123456789abcdef");
|
113
|
+
input = hex2binary("0000000000000000");
|
111
114
|
cipher = new _crypto.ARCFourCipher(key);
|
112
115
|
result = cipher.encryptBlock(input);
|
113
|
-
expected = hex2binary(
|
116
|
+
expected = hex2binary("7494c2e7104b0879");
|
114
117
|
expect(result).toEqual(expected);
|
115
118
|
});
|
116
|
-
it(
|
119
|
+
it("should pass test #3", function () {
|
117
120
|
var key, input, result, expected, cipher;
|
118
|
-
key = hex2binary(
|
119
|
-
input = hex2binary(
|
121
|
+
key = hex2binary("0000000000000000");
|
122
|
+
input = hex2binary("0000000000000000");
|
120
123
|
cipher = new _crypto.ARCFourCipher(key);
|
121
124
|
result = cipher.encryptBlock(input);
|
122
|
-
expected = hex2binary(
|
125
|
+
expected = hex2binary("de188941a3375d3a");
|
123
126
|
expect(result).toEqual(expected);
|
124
127
|
});
|
125
|
-
it(
|
128
|
+
it("should pass test #4", function () {
|
126
129
|
var key, input, result, expected, cipher;
|
127
|
-
key = hex2binary(
|
128
|
-
input = hex2binary(
|
130
|
+
key = hex2binary("ef012345");
|
131
|
+
input = hex2binary("00000000000000000000");
|
129
132
|
cipher = new _crypto.ARCFourCipher(key);
|
130
133
|
result = cipher.encryptBlock(input);
|
131
|
-
expected = hex2binary(
|
134
|
+
expected = hex2binary("d6a141a7ec3c38dfbd61");
|
132
135
|
expect(result).toEqual(expected);
|
133
136
|
});
|
134
|
-
it(
|
137
|
+
it("should pass test #5", function () {
|
135
138
|
var key, input, result, expected, cipher;
|
136
|
-
key = hex2binary(
|
137
|
-
input = hex2binary(
|
139
|
+
key = hex2binary("0123456789abcdef");
|
140
|
+
input = hex2binary("010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "10101010101010101010101010101010101010101010101010101010101010101010" + "101010101010101010101");
|
138
141
|
cipher = new _crypto.ARCFourCipher(key);
|
139
142
|
result = cipher.encryptBlock(input);
|
140
|
-
expected = hex2binary(
|
143
|
+
expected = hex2binary("7595c3e6114a09780c4ad452338e1ffd9a1be9498f813d76" + "533449b6778dcad8c78a8d2ba9ac66085d0e53d59c26c2d1c490c1ebbe0ce66d1b6b" + "1b13b6b919b847c25a91447a95e75e4ef16779cde8bf0a95850e32af9689444fd377" + "108f98fdcbd4e726567500990bcc7e0ca3c4aaa304a387d20f3b8fbbcd42a1bd311d" + "7a4303dda5ab078896ae80c18b0af66dff319616eb784e495ad2ce90d7f772a81747" + "b65f62093b1e0db9e5ba532fafec47508323e671327df9444432cb7367cec82f5d44" + "c0d00b67d650a075cd4b70dedd77eb9b10231b6b5b741347396d62897421d43df9b4" + "2e446e358e9c11a9b2184ecbef0cd8e7a877ef968f1390ec9b3d35a5585cb009290e" + "2fcde7b5ec66d9084be44055a619d9dd7fc3166f9487f7cb272912426445998514c1" + "5d53a18c864ce3a2b7555793988126520eacf2e3066e230c91bee4dd5304f5fd0405" + "b35bd99c73135d3d9bc335ee049ef69b3867bf2d7bd1eaa595d8bfc0066ff8d31509" + "eb0c6caa006c807a623ef84c3d33c195d23ee320c40de0558157c822d4b8c569d849" + "aed59d4e0fd7f379586b4b7ff684ed6a189f7486d49b9c4bad9ba24b96abf924372c" + "8a8fffb10d55354900a77a3db5f205e1b99fcd8660863a159ad4abe40fa48934163d" + "dde542a6585540fd683cbfd8c00f12129a284deacc4cdefe58be7137541c047126c8" + "d49e2755ab181ab7e940b0c0");
|
141
144
|
expect(result).toEqual(expected);
|
142
145
|
});
|
143
|
-
it(
|
146
|
+
it("should pass test #6", function () {
|
144
147
|
var key, input, result, expected, cipher;
|
145
|
-
key = hex2binary(
|
146
|
-
input = hex2binary(
|
148
|
+
key = hex2binary("fb029e3031323334");
|
149
|
+
input = hex2binary("aaaa0300000008004500004e661a00008011be640a0001220af" + "fffff00890089003a000080a601100001000000000000204543454a4548454346434" + "550464545494546464343414341434143414341414100002000011bd0b604");
|
147
150
|
cipher = new _crypto.ARCFourCipher(key);
|
148
151
|
result = cipher.encryptBlock(input);
|
149
|
-
expected = hex2binary(
|
152
|
+
expected = hex2binary("f69c5806bd6ce84626bcbefb9474650aad1f7909b0f64d5f" + "58a503a258b7ed22eb0ea64930d3a056a55742fcce141d485f8aa836dea18df42c53" + "80805ad0c61a5d6f58f41040b24b7d1a693856ed0d4398e7aee3bf0e2a2ca8f7");
|
150
153
|
expect(result).toEqual(expected);
|
151
154
|
});
|
152
|
-
it(
|
155
|
+
it("should pass test #7", function () {
|
153
156
|
var key, input, result, expected, cipher;
|
154
|
-
key = hex2binary(
|
155
|
-
input = hex2binary(
|
157
|
+
key = hex2binary("0123456789abcdef");
|
158
|
+
input = hex2binary("123456789abcdef0123456789abcdef0123456789abcdef012345678");
|
156
159
|
cipher = new _crypto.ARCFourCipher(key);
|
157
160
|
result = cipher.encryptBlock(input);
|
158
|
-
expected = hex2binary(
|
161
|
+
expected = hex2binary("66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf");
|
159
162
|
expect(result).toEqual(expected);
|
160
163
|
});
|
161
164
|
});
|
162
|
-
describe(
|
163
|
-
it(
|
165
|
+
describe("calculateSHA256", function () {
|
166
|
+
it("should properly hash abc", function () {
|
164
167
|
var input, result, expected;
|
165
|
-
input = (0, _util.stringToBytes)(
|
168
|
+
input = (0, _util.stringToBytes)("abc");
|
166
169
|
result = (0, _crypto.calculateSHA256)(input, 0, input.length);
|
167
|
-
expected = hex2binary(
|
170
|
+
expected = hex2binary("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD");
|
168
171
|
expect(result).toEqual(expected);
|
169
172
|
});
|
170
|
-
it(
|
173
|
+
it("should properly hash a multiblock input", function () {
|
171
174
|
var input, result, expected;
|
172
|
-
input = (0, _util.stringToBytes)(
|
175
|
+
input = (0, _util.stringToBytes)("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq");
|
173
176
|
result = (0, _crypto.calculateSHA256)(input, 0, input.length);
|
174
|
-
expected = hex2binary(
|
177
|
+
expected = hex2binary("248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1");
|
175
178
|
expect(result).toEqual(expected);
|
176
179
|
});
|
177
180
|
});
|
178
|
-
describe(
|
179
|
-
it(
|
181
|
+
describe("calculateSHA384", function () {
|
182
|
+
it("should properly hash abc", function () {
|
180
183
|
var input, result, expected;
|
181
|
-
input = (0, _util.stringToBytes)(
|
184
|
+
input = (0, _util.stringToBytes)("abc");
|
182
185
|
result = (0, _crypto.calculateSHA384)(input, 0, input.length);
|
183
|
-
expected = hex2binary(
|
186
|
+
expected = hex2binary("CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED163" + "1A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7");
|
184
187
|
expect(result).toEqual(expected);
|
185
188
|
});
|
186
|
-
it(
|
189
|
+
it("should properly hash a multiblock input", function () {
|
187
190
|
var input, result, expected;
|
188
|
-
input = (0, _util.stringToBytes)(
|
191
|
+
input = (0, _util.stringToBytes)("abcdefghbcdefghicdefghijdefghijkefghijklfghijklm" + "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs" + "mnopqrstnopqrstu");
|
189
192
|
result = (0, _crypto.calculateSHA384)(input, 0, input.length);
|
190
|
-
expected = hex2binary(
|
193
|
+
expected = hex2binary("09330C33F71147E83D192FC782CD1B4753111B173B3B05D2" + "2FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039");
|
191
194
|
expect(result).toEqual(expected);
|
192
195
|
});
|
193
196
|
});
|
194
|
-
describe(
|
195
|
-
it(
|
197
|
+
describe("calculateSHA512", function () {
|
198
|
+
it("should properly hash abc", function () {
|
196
199
|
var input, result, expected;
|
197
|
-
input = (0, _util.stringToBytes)(
|
200
|
+
input = (0, _util.stringToBytes)("abc");
|
198
201
|
result = (0, _crypto.calculateSHA512)(input, 0, input.length);
|
199
|
-
expected = hex2binary(
|
202
|
+
expected = hex2binary("DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA2" + "0A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD" + "454D4423643CE80E2A9AC94FA54CA49F");
|
200
203
|
expect(result).toEqual(expected);
|
201
204
|
});
|
202
|
-
it(
|
205
|
+
it("should properly hash a multiblock input", function () {
|
203
206
|
var input, result, expected;
|
204
|
-
input = (0, _util.stringToBytes)(
|
207
|
+
input = (0, _util.stringToBytes)("abcdefghbcdefghicdefghijdefghijkefghijklfghijklm" + "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs" + "mnopqrstnopqrstu");
|
205
208
|
result = (0, _crypto.calculateSHA512)(input, 0, input.length);
|
206
|
-
expected = hex2binary(
|
209
|
+
expected = hex2binary("8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA1" + "7299AEADB6889018501D289E4900F7E4331B99DEC4B5433A" + "C7D329EEB6DD26545E96E55B874BE909");
|
207
210
|
expect(result).toEqual(expected);
|
208
211
|
});
|
209
212
|
});
|
210
|
-
describe(
|
211
|
-
describe(
|
212
|
-
it(
|
213
|
+
describe("AES128", function () {
|
214
|
+
describe("Encryption", function () {
|
215
|
+
it("should be able to encrypt a block", function () {
|
213
216
|
var input, key, result, expected, iv, cipher;
|
214
|
-
input = hex2binary(
|
215
|
-
key = hex2binary(
|
216
|
-
iv = hex2binary(
|
217
|
+
input = hex2binary("00112233445566778899aabbccddeeff");
|
218
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f");
|
219
|
+
iv = hex2binary("00000000000000000000000000000000");
|
217
220
|
cipher = new _crypto.AES128Cipher(key);
|
218
221
|
result = cipher.encrypt(input, iv);
|
219
|
-
expected = hex2binary(
|
222
|
+
expected = hex2binary("69c4e0d86a7b0430d8cdb78070b4c55a");
|
220
223
|
expect(result).toEqual(expected);
|
221
224
|
});
|
222
225
|
});
|
223
|
-
describe(
|
224
|
-
it(
|
226
|
+
describe("Decryption", function () {
|
227
|
+
it("should be able to decrypt a block with IV in stream", function () {
|
225
228
|
var input, key, result, expected, cipher;
|
226
|
-
input = hex2binary(
|
227
|
-
key = hex2binary(
|
229
|
+
input = hex2binary("0000000000000000000000000000000069c4e0d86a7b0430d" + "8cdb78070b4c55a");
|
230
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f");
|
228
231
|
cipher = new _crypto.AES128Cipher(key);
|
229
232
|
result = cipher.decryptBlock(input);
|
230
|
-
expected = hex2binary(
|
233
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
231
234
|
expect(result).toEqual(expected);
|
232
235
|
});
|
233
236
|
});
|
234
237
|
});
|
235
|
-
describe(
|
236
|
-
describe(
|
237
|
-
it(
|
238
|
+
describe("AES256", function () {
|
239
|
+
describe("Encryption", function () {
|
240
|
+
it("should be able to encrypt a block", function () {
|
238
241
|
var input, key, result, expected, iv, cipher;
|
239
|
-
input = hex2binary(
|
240
|
-
key = hex2binary(
|
241
|
-
iv = hex2binary(
|
242
|
+
input = hex2binary("00112233445566778899aabbccddeeff");
|
243
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
244
|
+
iv = hex2binary("00000000000000000000000000000000");
|
242
245
|
cipher = new _crypto.AES256Cipher(key);
|
243
246
|
result = cipher.encrypt(input, iv);
|
244
|
-
expected = hex2binary(
|
247
|
+
expected = hex2binary("8ea2b7ca516745bfeafc49904b496089");
|
245
248
|
expect(result).toEqual(expected);
|
246
249
|
});
|
247
250
|
});
|
248
|
-
describe(
|
249
|
-
it(
|
251
|
+
describe("Decryption", function () {
|
252
|
+
it("should be able to decrypt a block with specified iv", function () {
|
250
253
|
var input, key, result, expected, cipher, iv;
|
251
|
-
input = hex2binary(
|
252
|
-
key = hex2binary(
|
253
|
-
iv = hex2binary(
|
254
|
+
input = hex2binary("8ea2b7ca516745bfeafc49904b496089");
|
255
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
256
|
+
iv = hex2binary("00000000000000000000000000000000");
|
254
257
|
cipher = new _crypto.AES256Cipher(key);
|
255
258
|
result = cipher.decryptBlock(input, false, iv);
|
256
|
-
expected = hex2binary(
|
259
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
257
260
|
expect(result).toEqual(expected);
|
258
261
|
});
|
259
|
-
it(
|
262
|
+
it("should be able to decrypt a block with IV in stream", function () {
|
260
263
|
var input, key, result, expected, cipher;
|
261
|
-
input = hex2binary(
|
262
|
-
key = hex2binary(
|
264
|
+
input = hex2binary("000000000000000000000000000000008ea2b7ca516745bf" + "eafc49904b496089");
|
265
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
263
266
|
cipher = new _crypto.AES256Cipher(key);
|
264
267
|
result = cipher.decryptBlock(input, false);
|
265
|
-
expected = hex2binary(
|
268
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
266
269
|
expect(result).toEqual(expected);
|
267
270
|
});
|
268
271
|
});
|
269
272
|
});
|
270
|
-
describe(
|
271
|
-
it(
|
273
|
+
describe("PDF17Algorithm", function () {
|
274
|
+
it("should correctly check a user key", function () {
|
272
275
|
var password, userValidation, userPassword, alg, result;
|
273
276
|
alg = new _crypto.PDF17();
|
274
277
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -277,7 +280,7 @@ describe('crypto', function () {
|
|
277
280
|
result = alg.checkUserPassword(password, userValidation, userPassword);
|
278
281
|
expect(result).toEqual(true);
|
279
282
|
});
|
280
|
-
it(
|
283
|
+
it("should correctly check an owner key", function () {
|
281
284
|
var password, ownerValidation, ownerPassword, alg, result, uBytes;
|
282
285
|
alg = new _crypto.PDF17();
|
283
286
|
password = new Uint8Array([111, 119, 110, 101, 114]);
|
@@ -287,7 +290,7 @@ describe('crypto', function () {
|
|
287
290
|
result = alg.checkOwnerPassword(password, ownerValidation, uBytes, ownerPassword);
|
288
291
|
expect(result).toEqual(true);
|
289
292
|
});
|
290
|
-
it(
|
293
|
+
it("should generate a file encryption key from the user key", function () {
|
291
294
|
var password, userKeySalt, expected, alg, result, userEncryption;
|
292
295
|
alg = new _crypto.PDF17();
|
293
296
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -297,7 +300,7 @@ describe('crypto', function () {
|
|
297
300
|
expected = new Uint8Array([63, 114, 136, 209, 87, 61, 12, 30, 249, 1, 186, 144, 254, 248, 163, 153, 151, 51, 133, 10, 80, 152, 206, 15, 72, 187, 231, 33, 224, 239, 13, 213]);
|
298
301
|
expect(result).toEqual(expected);
|
299
302
|
});
|
300
|
-
it(
|
303
|
+
it("should generate a file encryption key from the owner key", function () {
|
301
304
|
var password, ownerKeySalt, expected, alg, result, ownerEncryption;
|
302
305
|
var uBytes;
|
303
306
|
alg = new _crypto.PDF17();
|
@@ -310,8 +313,8 @@ describe('crypto', function () {
|
|
310
313
|
expect(result).toEqual(expected);
|
311
314
|
});
|
312
315
|
});
|
313
|
-
describe(
|
314
|
-
it(
|
316
|
+
describe("PDF20Algorithm", function () {
|
317
|
+
it("should correctly check a user key", function () {
|
315
318
|
var password, userValidation, userPassword, alg, result;
|
316
319
|
alg = new _crypto.PDF20();
|
317
320
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -320,7 +323,7 @@ describe('crypto', function () {
|
|
320
323
|
result = alg.checkUserPassword(password, userValidation, userPassword);
|
321
324
|
expect(result).toEqual(true);
|
322
325
|
});
|
323
|
-
it(
|
326
|
+
it("should correctly check an owner key", function () {
|
324
327
|
var password, ownerValidation, ownerPassword, alg, result, uBytes;
|
325
328
|
alg = new _crypto.PDF20();
|
326
329
|
password = new Uint8Array([111, 119, 110, 101, 114]);
|
@@ -330,7 +333,7 @@ describe('crypto', function () {
|
|
330
333
|
result = alg.checkOwnerPassword(password, ownerValidation, uBytes, ownerPassword);
|
331
334
|
expect(result).toEqual(true);
|
332
335
|
});
|
333
|
-
it(
|
336
|
+
it("should generate a file encryption key from the user key", function () {
|
334
337
|
var password, userKeySalt, expected, alg, result, userEncryption;
|
335
338
|
alg = new _crypto.PDF20();
|
336
339
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -340,7 +343,7 @@ describe('crypto', function () {
|
|
340
343
|
expected = new Uint8Array([42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248, 133, 18, 189, 61, 34, 107, 79, 29, 56, 59, 181, 213, 118, 113, 34, 65, 210, 87, 174, 22, 239]);
|
341
344
|
expect(result).toEqual(expected);
|
342
345
|
});
|
343
|
-
it(
|
346
|
+
it("should generate a file encryption key from the owner key", function () {
|
344
347
|
var password, ownerKeySalt, expected, alg, result, ownerEncryption;
|
345
348
|
var uBytes;
|
346
349
|
alg = new _crypto.PDF20();
|
@@ -354,24 +357,29 @@ describe('crypto', function () {
|
|
354
357
|
});
|
355
358
|
});
|
356
359
|
});
|
357
|
-
describe(
|
360
|
+
describe("CipherTransformFactory", function () {
|
358
361
|
function buildDict(map) {
|
359
362
|
var dict = new _primitives.Dict();
|
363
|
+
|
360
364
|
for (var key in map) {
|
361
365
|
dict.set(key, map[key]);
|
362
366
|
}
|
367
|
+
|
363
368
|
return dict;
|
364
369
|
}
|
370
|
+
|
365
371
|
function ensurePasswordCorrect(done, dict, fileId, password) {
|
366
372
|
try {
|
367
373
|
var factory = new _crypto.CipherTransformFactory(dict, fileId, password);
|
368
|
-
expect(
|
374
|
+
expect("createCipherTransform" in factory).toEqual(true);
|
369
375
|
} catch (ex) {
|
370
|
-
done.fail(
|
376
|
+
done.fail("Password should be accepted: " + ex);
|
371
377
|
return;
|
372
378
|
}
|
379
|
+
|
373
380
|
done();
|
374
381
|
}
|
382
|
+
|
375
383
|
function ensurePasswordNeeded(done, dict, fileId, password) {
|
376
384
|
try {
|
377
385
|
new _crypto.CipherTransformFactory(dict, fileId, password);
|
@@ -381,8 +389,10 @@ describe('CipherTransformFactory', function () {
|
|
381
389
|
done();
|
382
390
|
return;
|
383
391
|
}
|
384
|
-
|
392
|
+
|
393
|
+
done.fail("Password should be rejected.");
|
385
394
|
}
|
395
|
+
|
386
396
|
function ensurePasswordIncorrect(done, dict, fileId, password) {
|
387
397
|
try {
|
388
398
|
new _crypto.CipherTransformFactory(dict, fileId, password);
|
@@ -392,76 +402,78 @@ describe('CipherTransformFactory', function () {
|
|
392
402
|
done();
|
393
403
|
return;
|
394
404
|
}
|
395
|
-
|
405
|
+
|
406
|
+
done.fail("Password should be rejected.");
|
396
407
|
}
|
408
|
+
|
397
409
|
var fileId1, fileId2, dict1, dict2;
|
398
410
|
var aes256Dict, aes256IsoDict, aes256BlankDict, aes256IsoBlankDict;
|
399
411
|
beforeAll(function (done) {
|
400
|
-
fileId1 = unescape(
|
401
|
-
fileId2 = unescape(
|
412
|
+
fileId1 = unescape("%F6%C6%AF%17%F3rR%8DRM%9A%80%D1%EF%DF%18");
|
413
|
+
fileId2 = unescape("%3CL_%3AD%96%AF@%9A%9D%B3%3Cx%1Cv%AC");
|
402
414
|
dict1 = buildDict({
|
403
|
-
Filter: _primitives.Name.get(
|
415
|
+
Filter: _primitives.Name.get("Standard"),
|
404
416
|
V: 2,
|
405
417
|
Length: 128,
|
406
|
-
O: unescape(
|
407
|
-
U: unescape(
|
418
|
+
O: unescape("%80%C3%04%96%91o%20sl%3A%E6%1B%13T%91%F2%0DV%12%E3%FF%5E%B" + "B%E9VO%D8k%9A%CA%7C%5D"),
|
419
|
+
U: unescape("j%0C%8D%3EY%19%00%BCjd%7D%91%BD%AA%00%18%00%00%00%00%00%00" + "%00%00%00%00%00%00%00%00%00%00"),
|
408
420
|
P: -1028,
|
409
421
|
R: 3
|
410
422
|
});
|
411
423
|
dict2 = buildDict({
|
412
|
-
Filter: _primitives.Name.get(
|
424
|
+
Filter: _primitives.Name.get("Standard"),
|
413
425
|
V: 4,
|
414
426
|
Length: 128,
|
415
|
-
O: unescape(
|
416
|
-
U: unescape(
|
427
|
+
O: unescape("sF%14v.y5%27%DB%97%0A5%22%B3%E1%D4%AD%BD%9B%3C%B4%A5%89u%1" + "5%B2Y%F1h%D9%E9%F4"),
|
428
|
+
U: unescape("%93%04%89%A9%BF%8AE%A6%88%A2%DB%C2%A0%A8gn%00%00%00%00%00%" + "00%00%00%00%00%00%00%00%00%00%00"),
|
417
429
|
P: -1084,
|
418
430
|
R: 4
|
419
431
|
});
|
420
432
|
aes256Dict = buildDict({
|
421
|
-
Filter: _primitives.Name.get(
|
433
|
+
Filter: _primitives.Name.get("Standard"),
|
422
434
|
V: 5,
|
423
435
|
Length: 256,
|
424
|
-
O: unescape(
|
425
|
-
U: unescape(
|
426
|
-
OE: unescape(
|
427
|
-
UE: unescape(
|
428
|
-
Perms: unescape(
|
436
|
+
O: unescape("%3Cb%89%233e%C8%98%D2%B2%E2%E4%86%CD%A3%18%CC%7E%B1%24j2%2" + "4%7D%D2%AC%ABx%DEl%8Bs%F3vG%99%80%11e%3E%C8%F5%F2%0C%DA%7B" + "%18x"),
|
437
|
+
U: unescape("%83%F2%8F%A0W%02%8A%86O%FD%BD%AD%E0I%90%F1%BEQ%C5%0F%F9i%9" + "1%97%0F%C2A%03%01%7E%BB%DDu%A9%04%20%9Fe%16%DC%A8%5E%D7%C0" + "d%26%BC%28"),
|
438
|
+
OE: unescape("%D5%CA%0E%BDnLF%BF%06%C3%0A%BE%9Dd%90U%08%3E%7B%B2%9C%E52" + "%28%E5%D86%DE%22%26j%DF"),
|
439
|
+
UE: unescape("%23%96%C3%A9%F533%FF%9E%9E%21%F2%E7K%7D%BE%19%7E%ACr%C3%F" + "4%89%F5%EA%A5*J%3C%26%11%11"),
|
440
|
+
Perms: unescape("%D8%FC%844%E5e%0DB%5D%7Ff%FD%3COMM"),
|
429
441
|
P: -1084,
|
430
442
|
R: 5
|
431
443
|
});
|
432
444
|
aes256IsoDict = buildDict({
|
433
|
-
Filter: _primitives.Name.get(
|
445
|
+
Filter: _primitives.Name.get("Standard"),
|
434
446
|
V: 5,
|
435
447
|
Length: 256,
|
436
|
-
O: unescape(
|
437
|
-
U: unescape(
|
438
|
-
OE: unescape(
|
439
|
-
UE: unescape(
|
440
|
-
Perms: unescape(
|
448
|
+
O: unescape("X%E8%3E6%F5%1A%F5%D1%89%7B%DDH%C71%25%D9%1FJs%A7%7F%9E%B0M" + "-%A3W/%27Z%D9%8D%8E%E8%A9%D0%CA%D6%05%B9%1D%D0%B9.%0BL%87%" + "95"),
|
449
|
+
U: unescape("%5E%E6%CDK%A6c%FAL%DB%80%11U9%11%21%A4%96.g%B0%A0%9C%BB%E9" + "%A6%DF%A3%FD%93%EB_%B8S%F5%92e%C6%F7%22%C6%BF%0B%10%5E%ED%" + "D8%14%AF"),
|
450
|
+
OE: unescape("%D1I%E0Mg%9B%C9%B5%BED%DF%14%3EZ8%D2%05%F0%B2%80%EE%7CD%F" + "E%FD%F4%3El%D0%87%0A%FB"),
|
451
|
+
UE: unescape("y%D0%02%B5%E6Y%9C%3C%FD%8F%D4%1CT%B4%C4%B1%AD%80%DDk.%14%" + "5E%BA%873_%18%14%DF%FE%24"),
|
452
|
+
Perms: unescape("l%AD%0F%A0%EBM%86WM%3E%CB%B5%E0X%C97"),
|
441
453
|
P: -1084,
|
442
454
|
R: 6
|
443
455
|
});
|
444
456
|
aes256BlankDict = buildDict({
|
445
|
-
Filter: _primitives.Name.get(
|
457
|
+
Filter: _primitives.Name.get("Standard"),
|
446
458
|
V: 5,
|
447
459
|
Length: 256,
|
448
|
-
O: unescape(
|
449
|
-
U: unescape(
|
450
|
-
OE: unescape(
|
451
|
-
UE: unescape(
|
452
|
-
Perms: unescape(
|
460
|
+
O: unescape("%B8p%04%C3g%26%FCW%CCN%D4%16%A1%E8%950YZ%C9%9E%B1-%97%F3%F" + "E%03%13%19ffZn%8F%F5%EB%EC%CC5sV%10e%CEl%B5%E9G%C1"),
|
461
|
+
U: unescape("%83%D4zi%F1O0%961%12%CC%82%CB%CA%BF5y%FD%21%EB%E4%D1%B5%1D" + "%D6%FA%14%F3%BE%8Fqs%EF%88%DE%E2%E8%DC%F55%E4%B8%16%C8%14%" + "8De%1E"),
|
462
|
+
OE: unescape("%8F%19%E8%D4%27%D5%07%CA%C6%A1%11%A6a%5Bt%F4%DF%0F%84%29%" + "0F%E4%EFF7%5B%5B%11%A0%8F%17e"),
|
463
|
+
UE: unescape("%81%F5%5D%B0%28%81%E4%7F_%7C%8F%85b%A0%7E%10%D0%88lx%7B%7" + "EJ%5E%912%B6d%12%27%05%F6"),
|
464
|
+
Perms: unescape("%86%1562%0D%AE%A2%FB%5D%3B%22%3Dq%12%B2H"),
|
453
465
|
P: -1084,
|
454
466
|
R: 5
|
455
467
|
});
|
456
468
|
aes256IsoBlankDict = buildDict({
|
457
|
-
Filter: _primitives.Name.get(
|
469
|
+
Filter: _primitives.Name.get("Standard"),
|
458
470
|
V: 5,
|
459
471
|
Length: 256,
|
460
|
-
O: unescape(
|
461
|
-
U: unescape(
|
462
|
-
OE: unescape(
|
463
|
-
UE: unescape(
|
464
|
-
Perms: unescape(
|
472
|
+
O: unescape("%F7%DB%99U%A6M%ACk%AF%CF%D7AFw%E9%C1%91%CBDgI%23R%CF%0C%15" + "r%D74%0D%CE%E9%91@%E4%98QF%BF%88%7Ej%DE%AD%8F%F4@%C1"),
|
473
|
+
U: unescape("%1A%A9%DC%918%83%93k%29%5B%117%B16%DB%E8%8E%FE%28%E5%89%D4" + "%0E%AD%12%3B%7DN_6fez%8BG%18%05YOh%7DZH%A3Z%87%17*"),
|
474
|
+
OE: unescape("%A4a%88%20h%1B%7F%CD%D5%CAc%D8R%83%E5%D6%1C%D2%98%07%984%" + "BA%AF%1B%B4%7FQ%F8%1EU%7D"),
|
475
|
+
UE: unescape("%A0%0AZU%27%1D%27%2C%0B%FE%0E%A2L%F9b%5E%A1%B9%D6v7b%B26%" + "A9N%99%F1%A4Deq"),
|
476
|
+
Perms: unescape("%03%F2i%07%0D%C3%F9%F2%28%80%B7%F5%DD%D1c%EB"),
|
465
477
|
P: -1084,
|
466
478
|
R: 6
|
467
479
|
});
|
@@ -471,54 +483,54 @@ describe('CipherTransformFactory', function () {
|
|
471
483
|
fileId1 = fileId2 = dict1 = dict2 = null;
|
472
484
|
aes256Dict = aes256IsoDict = aes256BlankDict = aes256IsoBlankDict = null;
|
473
485
|
});
|
474
|
-
describe(
|
475
|
-
describe(
|
476
|
-
it(
|
477
|
-
ensurePasswordCorrect(done, aes256Dict, fileId1,
|
486
|
+
describe("#ctor", function () {
|
487
|
+
describe("AES256 Revision 5", function () {
|
488
|
+
it("should accept user password", function (done) {
|
489
|
+
ensurePasswordCorrect(done, aes256Dict, fileId1, "user");
|
478
490
|
});
|
479
|
-
it(
|
480
|
-
ensurePasswordCorrect(done, aes256Dict, fileId1,
|
491
|
+
it("should accept owner password", function (done) {
|
492
|
+
ensurePasswordCorrect(done, aes256Dict, fileId1, "owner");
|
481
493
|
});
|
482
|
-
it(
|
494
|
+
it("should not accept blank password", function (done) {
|
483
495
|
ensurePasswordNeeded(done, aes256Dict, fileId1);
|
484
496
|
});
|
485
|
-
it(
|
486
|
-
ensurePasswordIncorrect(done, aes256Dict, fileId1,
|
497
|
+
it("should not accept wrong password", function (done) {
|
498
|
+
ensurePasswordIncorrect(done, aes256Dict, fileId1, "wrong");
|
487
499
|
});
|
488
|
-
it(
|
500
|
+
it("should accept blank password", function (done) {
|
489
501
|
ensurePasswordCorrect(done, aes256BlankDict, fileId1);
|
490
502
|
});
|
491
503
|
});
|
492
|
-
describe(
|
493
|
-
it(
|
494
|
-
ensurePasswordCorrect(done, aes256IsoDict, fileId1,
|
504
|
+
describe("AES256 Revision 6", function () {
|
505
|
+
it("should accept user password", function (done) {
|
506
|
+
ensurePasswordCorrect(done, aes256IsoDict, fileId1, "user");
|
495
507
|
});
|
496
|
-
it(
|
497
|
-
ensurePasswordCorrect(done, aes256IsoDict, fileId1,
|
508
|
+
it("should accept owner password", function (done) {
|
509
|
+
ensurePasswordCorrect(done, aes256IsoDict, fileId1, "owner");
|
498
510
|
});
|
499
|
-
it(
|
511
|
+
it("should not accept blank password", function (done) {
|
500
512
|
ensurePasswordNeeded(done, aes256IsoDict, fileId1);
|
501
513
|
});
|
502
|
-
it(
|
503
|
-
ensurePasswordIncorrect(done, aes256IsoDict, fileId1,
|
514
|
+
it("should not accept wrong password", function (done) {
|
515
|
+
ensurePasswordIncorrect(done, aes256IsoDict, fileId1, "wrong");
|
504
516
|
});
|
505
|
-
it(
|
517
|
+
it("should accept blank password", function (done) {
|
506
518
|
ensurePasswordCorrect(done, aes256IsoBlankDict, fileId1);
|
507
519
|
});
|
508
520
|
});
|
509
|
-
it(
|
510
|
-
ensurePasswordCorrect(done, dict1, fileId1,
|
521
|
+
it("should accept user password", function (done) {
|
522
|
+
ensurePasswordCorrect(done, dict1, fileId1, "123456");
|
511
523
|
});
|
512
|
-
it(
|
513
|
-
ensurePasswordCorrect(done, dict1, fileId1,
|
524
|
+
it("should accept owner password", function (done) {
|
525
|
+
ensurePasswordCorrect(done, dict1, fileId1, "654321");
|
514
526
|
});
|
515
|
-
it(
|
527
|
+
it("should not accept blank password", function (done) {
|
516
528
|
ensurePasswordNeeded(done, dict1, fileId1);
|
517
529
|
});
|
518
|
-
it(
|
519
|
-
ensurePasswordIncorrect(done, dict1, fileId1,
|
530
|
+
it("should not accept wrong password", function (done) {
|
531
|
+
ensurePasswordIncorrect(done, dict1, fileId1, "wrong");
|
520
532
|
});
|
521
|
-
it(
|
533
|
+
it("should accept blank password", function (done) {
|
522
534
|
ensurePasswordCorrect(done, dict2, fileId2);
|
523
535
|
});
|
524
536
|
});
|