pdfjs-dist 2.1.266 → 2.5.207
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 +8382 -18492
- 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 +20417 -29816
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25688 -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 +58239 -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 +403 -0
- package/es5/web/pdf_viewer.js +7742 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1475 -4897
- 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 +750 -899
- package/lib/core/arithmetic_decoder.js +81 -97
- package/lib/core/bidi.js +54 -46
- package/lib/core/ccitt.js +88 -81
- package/lib/core/ccitt_stream.js +15 -14
- package/lib/core/cff_parser.js +235 -183
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +447 -542
- package/lib/core/cmap.js +222 -264
- package/lib/core/colorspace.js +699 -863
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +379 -437
- package/lib/core/document.js +573 -660
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +1103 -868
- package/lib/core/font_renderer.js +135 -178
- package/lib/core/fonts.js +570 -491
- package/lib/core/function.js +291 -288
- package/lib/core/glyphlist.js +4527 -4526
- package/lib/core/image.js +145 -149
- package/lib/core/image_utils.js +170 -0
- package/lib/core/jbig2.js +325 -316
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +21 -26
- package/lib/core/jpg.js +284 -232
- package/lib/core/jpx.js +161 -143
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2929 -2929
- package/lib/core/murmurhash3.js +90 -101
- package/lib/core/obj.js +1183 -1157
- package/lib/core/operator_list.js +99 -67
- package/lib/core/parser.js +972 -911
- package/lib/core/pattern.js +87 -70
- package/lib/core/pdf_manager.js +150 -315
- package/lib/core/primitives.js +83 -56
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +94 -74
- package/lib/core/type1_parser.js +87 -69
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +193 -390
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +741 -972
- package/lib/display/api.js +1500 -1791
- package/lib/display/api_compatibility.js +12 -17
- package/lib/display/canvas.js +165 -165
- package/lib/display/content_disposition.js +40 -59
- package/lib/display/display_utils.js +515 -0
- package/lib/display/fetch_stream.js +183 -298
- package/lib/display/font_loader.js +273 -413
- package/lib/display/metadata.js +86 -98
- package/lib/display/network.js +266 -359
- package/lib/display/network_utils.js +25 -18
- package/lib/display/node_stream.js +285 -458
- package/lib/display/pattern_helper.js +113 -65
- package/lib/display/svg.js +1166 -901
- package/lib/display/text_layer.js +156 -132
- package/lib/display/transport_stream.js +262 -278
- package/lib/display/webgl.js +70 -83
- package/lib/display/worker_options.js +3 -3
- package/lib/display/xml_parser.js +303 -392
- package/lib/examples/node/domstubs.js +40 -37
- package/lib/pdf.js +226 -59
- package/lib/pdf.worker.js +14 -6
- package/lib/shared/compatibility.js +3 -246
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +327 -332
- package/lib/shared/util.js +266 -416
- package/lib/test/unit/annotation_spec.js +1555 -701
- package/lib/test/unit/api_spec.js +802 -604
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +84 -69
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +74 -76
- package/lib/test/unit/colorspace_spec.js +166 -161
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +181 -181
- package/lib/test/unit/custom_spec.js +20 -22
- package/lib/test/unit/display_svg_spec.js +34 -39
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +16 -21
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +83 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +46 -30
- package/lib/test/unit/message_handler_spec.js +173 -159
- package/lib/test/unit/metadata_spec.js +69 -69
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +13 -61
- package/lib/test/unit/network_utils_spec.js +183 -119
- package/lib/test/unit/node_stream_spec.js +78 -92
- package/lib/test/unit/parser_spec.js +172 -114
- package/lib/test/unit/pdf_find_controller_spec.js +55 -86
- package/lib/test/unit/pdf_find_utils_spec.js +32 -32
- package/lib/test/unit/pdf_history_spec.js +32 -32
- package/lib/test/unit/primitives_spec.js +140 -125
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +131 -143
- package/lib/test/unit/testreporter.js +19 -19
- package/lib/test/unit/type1_parser_spec.js +42 -42
- package/lib/test/unit/ui_utils_spec.js +297 -459
- package/lib/test/unit/unicode_spec.js +38 -38
- package/lib/test/unit/util_spec.js +121 -305
- package/lib/web/annotation_layer_builder.js +66 -103
- package/lib/web/app.js +1328 -1214
- package/lib/web/app_options.js +105 -107
- package/lib/web/base_viewer.js +824 -838
- package/lib/web/chromecom.js +165 -252
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +39 -55
- package/lib/web/firefox_print_service.js +37 -27
- package/lib/web/firefoxcom.js +212 -363
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +32 -30
- package/lib/web/interfaces.js +80 -254
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +113 -131
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +221 -306
- package/lib/web/pdf_find_bar.js +136 -170
- package/lib/web/pdf_find_controller.js +491 -548
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +397 -406
- package/lib/web/pdf_link_service.js +304 -348
- package/lib/web/pdf_outline_viewer.js +140 -175
- package/lib/web/pdf_page_view.js +452 -523
- package/lib/web/pdf_presentation_mode.js +308 -357
- package/lib/web/pdf_print_service.js +90 -104
- package/lib/web/pdf_rendering_queue.js +84 -108
- package/lib/web/pdf_sidebar.js +276 -306
- package/lib/web/pdf_sidebar_resizer.js +92 -119
- package/lib/web/pdf_single_page_viewer.js +77 -126
- package/lib/web/pdf_thumbnail_view.js +276 -297
- package/lib/web/pdf_thumbnail_viewer.js +186 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +82 -286
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +282 -339
- package/lib/web/toolbar.js +217 -210
- package/lib/web/ui_utils.js +267 -420
- package/lib/web/view_history.js +52 -226
- package/lib/web/viewer_compatibility.js +21 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +35 -25
- package/web/pdf_viewer.js +3489 -4855
- 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 -494
- package/lib/shared/streams_polyfill.js +0 -43
- package/lib/shared/url_polyfill.js +0 -56
- package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -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.
|
@@ -21,15 +21,15 @@
|
|
21
21
|
*/
|
22
22
|
"use strict";
|
23
23
|
|
24
|
-
var _crypto = require("../../core/crypto");
|
24
|
+
var _crypto = require("../../core/crypto.js");
|
25
25
|
|
26
|
-
var _primitives = require("../../core/primitives");
|
26
|
+
var _primitives = require("../../core/primitives.js");
|
27
27
|
|
28
|
-
var _util = require("../../shared/util");
|
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,
|
@@ -46,232 +46,232 @@ describe('crypto', function () {
|
|
46
46
|
return result;
|
47
47
|
}
|
48
48
|
|
49
|
-
describe(
|
50
|
-
it(
|
49
|
+
describe("calculateMD5", function () {
|
50
|
+
it("should pass RFC 1321 test #1", function () {
|
51
51
|
var input, result, expected;
|
52
|
-
input = (0, _util.stringToBytes)(
|
52
|
+
input = (0, _util.stringToBytes)("");
|
53
53
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
54
|
-
expected = hex2binary(
|
54
|
+
expected = hex2binary("d41d8cd98f00b204e9800998ecf8427e");
|
55
55
|
expect(result).toEqual(expected);
|
56
56
|
});
|
57
|
-
it(
|
57
|
+
it("should pass RFC 1321 test #2", function () {
|
58
58
|
var input, result, expected;
|
59
|
-
input = (0, _util.stringToBytes)(
|
59
|
+
input = (0, _util.stringToBytes)("a");
|
60
60
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
61
|
-
expected = hex2binary(
|
61
|
+
expected = hex2binary("0cc175b9c0f1b6a831c399e269772661");
|
62
62
|
expect(result).toEqual(expected);
|
63
63
|
});
|
64
|
-
it(
|
64
|
+
it("should pass RFC 1321 test #3", function () {
|
65
65
|
var input, result, expected;
|
66
|
-
input = (0, _util.stringToBytes)(
|
66
|
+
input = (0, _util.stringToBytes)("abc");
|
67
67
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
68
|
-
expected = hex2binary(
|
68
|
+
expected = hex2binary("900150983cd24fb0d6963f7d28e17f72");
|
69
69
|
expect(result).toEqual(expected);
|
70
70
|
});
|
71
|
-
it(
|
71
|
+
it("should pass RFC 1321 test #4", function () {
|
72
72
|
var input, result, expected;
|
73
|
-
input = (0, _util.stringToBytes)(
|
73
|
+
input = (0, _util.stringToBytes)("message digest");
|
74
74
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
75
|
-
expected = hex2binary(
|
75
|
+
expected = hex2binary("f96b697d7cb7938d525a2f31aaf161d0");
|
76
76
|
expect(result).toEqual(expected);
|
77
77
|
});
|
78
|
-
it(
|
78
|
+
it("should pass RFC 1321 test #5", function () {
|
79
79
|
var input, result, expected;
|
80
|
-
input = (0, _util.stringToBytes)(
|
80
|
+
input = (0, _util.stringToBytes)("abcdefghijklmnopqrstuvwxyz");
|
81
81
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
82
|
-
expected = hex2binary(
|
82
|
+
expected = hex2binary("c3fcd3d76192e4007dfb496cca67e13b");
|
83
83
|
expect(result).toEqual(expected);
|
84
84
|
});
|
85
|
-
it(
|
85
|
+
it("should pass RFC 1321 test #6", function () {
|
86
86
|
var input, result, expected;
|
87
|
-
input = (0, _util.stringToBytes)(
|
87
|
+
input = (0, _util.stringToBytes)("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
88
88
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
89
|
-
expected = hex2binary(
|
89
|
+
expected = hex2binary("d174ab98d277d9f5a5611c2c9f419d9f");
|
90
90
|
expect(result).toEqual(expected);
|
91
91
|
});
|
92
|
-
it(
|
92
|
+
it("should pass RFC 1321 test #7", function () {
|
93
93
|
var input, result, expected;
|
94
|
-
input = (0, _util.stringToBytes)(
|
94
|
+
input = (0, _util.stringToBytes)("123456789012345678901234567890123456789012345678" + "90123456789012345678901234567890");
|
95
95
|
result = (0, _crypto.calculateMD5)(input, 0, input.length);
|
96
|
-
expected = hex2binary(
|
96
|
+
expected = hex2binary("57edf4a22be3c955ac49da2e2107b67a");
|
97
97
|
expect(result).toEqual(expected);
|
98
98
|
});
|
99
99
|
});
|
100
|
-
describe(
|
101
|
-
it(
|
100
|
+
describe("ARCFourCipher", function () {
|
101
|
+
it("should pass test #1", function () {
|
102
102
|
var key, input, result, expected, cipher;
|
103
|
-
key = hex2binary(
|
104
|
-
input = hex2binary(
|
103
|
+
key = hex2binary("0123456789abcdef");
|
104
|
+
input = hex2binary("0123456789abcdef");
|
105
105
|
cipher = new _crypto.ARCFourCipher(key);
|
106
106
|
result = cipher.encryptBlock(input);
|
107
|
-
expected = hex2binary(
|
107
|
+
expected = hex2binary("75b7878099e0c596");
|
108
108
|
expect(result).toEqual(expected);
|
109
109
|
});
|
110
|
-
it(
|
110
|
+
it("should pass test #2", function () {
|
111
111
|
var key, input, result, expected, cipher;
|
112
|
-
key = hex2binary(
|
113
|
-
input = hex2binary(
|
112
|
+
key = hex2binary("0123456789abcdef");
|
113
|
+
input = hex2binary("0000000000000000");
|
114
114
|
cipher = new _crypto.ARCFourCipher(key);
|
115
115
|
result = cipher.encryptBlock(input);
|
116
|
-
expected = hex2binary(
|
116
|
+
expected = hex2binary("7494c2e7104b0879");
|
117
117
|
expect(result).toEqual(expected);
|
118
118
|
});
|
119
|
-
it(
|
119
|
+
it("should pass test #3", function () {
|
120
120
|
var key, input, result, expected, cipher;
|
121
|
-
key = hex2binary(
|
122
|
-
input = hex2binary(
|
121
|
+
key = hex2binary("0000000000000000");
|
122
|
+
input = hex2binary("0000000000000000");
|
123
123
|
cipher = new _crypto.ARCFourCipher(key);
|
124
124
|
result = cipher.encryptBlock(input);
|
125
|
-
expected = hex2binary(
|
125
|
+
expected = hex2binary("de188941a3375d3a");
|
126
126
|
expect(result).toEqual(expected);
|
127
127
|
});
|
128
|
-
it(
|
128
|
+
it("should pass test #4", function () {
|
129
129
|
var key, input, result, expected, cipher;
|
130
|
-
key = hex2binary(
|
131
|
-
input = hex2binary(
|
130
|
+
key = hex2binary("ef012345");
|
131
|
+
input = hex2binary("00000000000000000000");
|
132
132
|
cipher = new _crypto.ARCFourCipher(key);
|
133
133
|
result = cipher.encryptBlock(input);
|
134
|
-
expected = hex2binary(
|
134
|
+
expected = hex2binary("d6a141a7ec3c38dfbd61");
|
135
135
|
expect(result).toEqual(expected);
|
136
136
|
});
|
137
|
-
it(
|
137
|
+
it("should pass test #5", function () {
|
138
138
|
var key, input, result, expected, cipher;
|
139
|
-
key = hex2binary(
|
140
|
-
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");
|
141
141
|
cipher = new _crypto.ARCFourCipher(key);
|
142
142
|
result = cipher.encryptBlock(input);
|
143
|
-
expected = hex2binary(
|
143
|
+
expected = hex2binary("7595c3e6114a09780c4ad452338e1ffd9a1be9498f813d76" + "533449b6778dcad8c78a8d2ba9ac66085d0e53d59c26c2d1c490c1ebbe0ce66d1b6b" + "1b13b6b919b847c25a91447a95e75e4ef16779cde8bf0a95850e32af9689444fd377" + "108f98fdcbd4e726567500990bcc7e0ca3c4aaa304a387d20f3b8fbbcd42a1bd311d" + "7a4303dda5ab078896ae80c18b0af66dff319616eb784e495ad2ce90d7f772a81747" + "b65f62093b1e0db9e5ba532fafec47508323e671327df9444432cb7367cec82f5d44" + "c0d00b67d650a075cd4b70dedd77eb9b10231b6b5b741347396d62897421d43df9b4" + "2e446e358e9c11a9b2184ecbef0cd8e7a877ef968f1390ec9b3d35a5585cb009290e" + "2fcde7b5ec66d9084be44055a619d9dd7fc3166f9487f7cb272912426445998514c1" + "5d53a18c864ce3a2b7555793988126520eacf2e3066e230c91bee4dd5304f5fd0405" + "b35bd99c73135d3d9bc335ee049ef69b3867bf2d7bd1eaa595d8bfc0066ff8d31509" + "eb0c6caa006c807a623ef84c3d33c195d23ee320c40de0558157c822d4b8c569d849" + "aed59d4e0fd7f379586b4b7ff684ed6a189f7486d49b9c4bad9ba24b96abf924372c" + "8a8fffb10d55354900a77a3db5f205e1b99fcd8660863a159ad4abe40fa48934163d" + "dde542a6585540fd683cbfd8c00f12129a284deacc4cdefe58be7137541c047126c8" + "d49e2755ab181ab7e940b0c0");
|
144
144
|
expect(result).toEqual(expected);
|
145
145
|
});
|
146
|
-
it(
|
146
|
+
it("should pass test #6", function () {
|
147
147
|
var key, input, result, expected, cipher;
|
148
|
-
key = hex2binary(
|
149
|
-
input = hex2binary(
|
148
|
+
key = hex2binary("fb029e3031323334");
|
149
|
+
input = hex2binary("aaaa0300000008004500004e661a00008011be640a0001220af" + "fffff00890089003a000080a601100001000000000000204543454a4548454346434" + "550464545494546464343414341434143414341414100002000011bd0b604");
|
150
150
|
cipher = new _crypto.ARCFourCipher(key);
|
151
151
|
result = cipher.encryptBlock(input);
|
152
|
-
expected = hex2binary(
|
152
|
+
expected = hex2binary("f69c5806bd6ce84626bcbefb9474650aad1f7909b0f64d5f" + "58a503a258b7ed22eb0ea64930d3a056a55742fcce141d485f8aa836dea18df42c53" + "80805ad0c61a5d6f58f41040b24b7d1a693856ed0d4398e7aee3bf0e2a2ca8f7");
|
153
153
|
expect(result).toEqual(expected);
|
154
154
|
});
|
155
|
-
it(
|
155
|
+
it("should pass test #7", function () {
|
156
156
|
var key, input, result, expected, cipher;
|
157
|
-
key = hex2binary(
|
158
|
-
input = hex2binary(
|
157
|
+
key = hex2binary("0123456789abcdef");
|
158
|
+
input = hex2binary("123456789abcdef0123456789abcdef0123456789abcdef012345678");
|
159
159
|
cipher = new _crypto.ARCFourCipher(key);
|
160
160
|
result = cipher.encryptBlock(input);
|
161
|
-
expected = hex2binary(
|
161
|
+
expected = hex2binary("66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf");
|
162
162
|
expect(result).toEqual(expected);
|
163
163
|
});
|
164
164
|
});
|
165
|
-
describe(
|
166
|
-
it(
|
165
|
+
describe("calculateSHA256", function () {
|
166
|
+
it("should properly hash abc", function () {
|
167
167
|
var input, result, expected;
|
168
|
-
input = (0, _util.stringToBytes)(
|
168
|
+
input = (0, _util.stringToBytes)("abc");
|
169
169
|
result = (0, _crypto.calculateSHA256)(input, 0, input.length);
|
170
|
-
expected = hex2binary(
|
170
|
+
expected = hex2binary("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD");
|
171
171
|
expect(result).toEqual(expected);
|
172
172
|
});
|
173
|
-
it(
|
173
|
+
it("should properly hash a multiblock input", function () {
|
174
174
|
var input, result, expected;
|
175
|
-
input = (0, _util.stringToBytes)(
|
175
|
+
input = (0, _util.stringToBytes)("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq");
|
176
176
|
result = (0, _crypto.calculateSHA256)(input, 0, input.length);
|
177
|
-
expected = hex2binary(
|
177
|
+
expected = hex2binary("248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1");
|
178
178
|
expect(result).toEqual(expected);
|
179
179
|
});
|
180
180
|
});
|
181
|
-
describe(
|
182
|
-
it(
|
181
|
+
describe("calculateSHA384", function () {
|
182
|
+
it("should properly hash abc", function () {
|
183
183
|
var input, result, expected;
|
184
|
-
input = (0, _util.stringToBytes)(
|
184
|
+
input = (0, _util.stringToBytes)("abc");
|
185
185
|
result = (0, _crypto.calculateSHA384)(input, 0, input.length);
|
186
|
-
expected = hex2binary(
|
186
|
+
expected = hex2binary("CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED163" + "1A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7");
|
187
187
|
expect(result).toEqual(expected);
|
188
188
|
});
|
189
|
-
it(
|
189
|
+
it("should properly hash a multiblock input", function () {
|
190
190
|
var input, result, expected;
|
191
|
-
input = (0, _util.stringToBytes)(
|
191
|
+
input = (0, _util.stringToBytes)("abcdefghbcdefghicdefghijdefghijkefghijklfghijklm" + "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs" + "mnopqrstnopqrstu");
|
192
192
|
result = (0, _crypto.calculateSHA384)(input, 0, input.length);
|
193
|
-
expected = hex2binary(
|
193
|
+
expected = hex2binary("09330C33F71147E83D192FC782CD1B4753111B173B3B05D2" + "2FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039");
|
194
194
|
expect(result).toEqual(expected);
|
195
195
|
});
|
196
196
|
});
|
197
|
-
describe(
|
198
|
-
it(
|
197
|
+
describe("calculateSHA512", function () {
|
198
|
+
it("should properly hash abc", function () {
|
199
199
|
var input, result, expected;
|
200
|
-
input = (0, _util.stringToBytes)(
|
200
|
+
input = (0, _util.stringToBytes)("abc");
|
201
201
|
result = (0, _crypto.calculateSHA512)(input, 0, input.length);
|
202
|
-
expected = hex2binary(
|
202
|
+
expected = hex2binary("DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA2" + "0A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD" + "454D4423643CE80E2A9AC94FA54CA49F");
|
203
203
|
expect(result).toEqual(expected);
|
204
204
|
});
|
205
|
-
it(
|
205
|
+
it("should properly hash a multiblock input", function () {
|
206
206
|
var input, result, expected;
|
207
|
-
input = (0, _util.stringToBytes)(
|
207
|
+
input = (0, _util.stringToBytes)("abcdefghbcdefghicdefghijdefghijkefghijklfghijklm" + "ghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrs" + "mnopqrstnopqrstu");
|
208
208
|
result = (0, _crypto.calculateSHA512)(input, 0, input.length);
|
209
|
-
expected = hex2binary(
|
209
|
+
expected = hex2binary("8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA1" + "7299AEADB6889018501D289E4900F7E4331B99DEC4B5433A" + "C7D329EEB6DD26545E96E55B874BE909");
|
210
210
|
expect(result).toEqual(expected);
|
211
211
|
});
|
212
212
|
});
|
213
|
-
describe(
|
214
|
-
describe(
|
215
|
-
it(
|
213
|
+
describe("AES128", function () {
|
214
|
+
describe("Encryption", function () {
|
215
|
+
it("should be able to encrypt a block", function () {
|
216
216
|
var input, key, result, expected, iv, cipher;
|
217
|
-
input = hex2binary(
|
218
|
-
key = hex2binary(
|
219
|
-
iv = hex2binary(
|
217
|
+
input = hex2binary("00112233445566778899aabbccddeeff");
|
218
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f");
|
219
|
+
iv = hex2binary("00000000000000000000000000000000");
|
220
220
|
cipher = new _crypto.AES128Cipher(key);
|
221
221
|
result = cipher.encrypt(input, iv);
|
222
|
-
expected = hex2binary(
|
222
|
+
expected = hex2binary("69c4e0d86a7b0430d8cdb78070b4c55a");
|
223
223
|
expect(result).toEqual(expected);
|
224
224
|
});
|
225
225
|
});
|
226
|
-
describe(
|
227
|
-
it(
|
226
|
+
describe("Decryption", function () {
|
227
|
+
it("should be able to decrypt a block with IV in stream", function () {
|
228
228
|
var input, key, result, expected, cipher;
|
229
|
-
input = hex2binary(
|
230
|
-
key = hex2binary(
|
229
|
+
input = hex2binary("0000000000000000000000000000000069c4e0d86a7b0430d" + "8cdb78070b4c55a");
|
230
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f");
|
231
231
|
cipher = new _crypto.AES128Cipher(key);
|
232
232
|
result = cipher.decryptBlock(input);
|
233
|
-
expected = hex2binary(
|
233
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
234
234
|
expect(result).toEqual(expected);
|
235
235
|
});
|
236
236
|
});
|
237
237
|
});
|
238
|
-
describe(
|
239
|
-
describe(
|
240
|
-
it(
|
238
|
+
describe("AES256", function () {
|
239
|
+
describe("Encryption", function () {
|
240
|
+
it("should be able to encrypt a block", function () {
|
241
241
|
var input, key, result, expected, iv, cipher;
|
242
|
-
input = hex2binary(
|
243
|
-
key = hex2binary(
|
244
|
-
iv = hex2binary(
|
242
|
+
input = hex2binary("00112233445566778899aabbccddeeff");
|
243
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
244
|
+
iv = hex2binary("00000000000000000000000000000000");
|
245
245
|
cipher = new _crypto.AES256Cipher(key);
|
246
246
|
result = cipher.encrypt(input, iv);
|
247
|
-
expected = hex2binary(
|
247
|
+
expected = hex2binary("8ea2b7ca516745bfeafc49904b496089");
|
248
248
|
expect(result).toEqual(expected);
|
249
249
|
});
|
250
250
|
});
|
251
|
-
describe(
|
252
|
-
it(
|
251
|
+
describe("Decryption", function () {
|
252
|
+
it("should be able to decrypt a block with specified iv", function () {
|
253
253
|
var input, key, result, expected, cipher, iv;
|
254
|
-
input = hex2binary(
|
255
|
-
key = hex2binary(
|
256
|
-
iv = hex2binary(
|
254
|
+
input = hex2binary("8ea2b7ca516745bfeafc49904b496089");
|
255
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
256
|
+
iv = hex2binary("00000000000000000000000000000000");
|
257
257
|
cipher = new _crypto.AES256Cipher(key);
|
258
258
|
result = cipher.decryptBlock(input, false, iv);
|
259
|
-
expected = hex2binary(
|
259
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
260
260
|
expect(result).toEqual(expected);
|
261
261
|
});
|
262
|
-
it(
|
262
|
+
it("should be able to decrypt a block with IV in stream", function () {
|
263
263
|
var input, key, result, expected, cipher;
|
264
|
-
input = hex2binary(
|
265
|
-
key = hex2binary(
|
264
|
+
input = hex2binary("000000000000000000000000000000008ea2b7ca516745bf" + "eafc49904b496089");
|
265
|
+
key = hex2binary("000102030405060708090a0b0c0d0e0f101112131415161718" + "191a1b1c1d1e1f");
|
266
266
|
cipher = new _crypto.AES256Cipher(key);
|
267
267
|
result = cipher.decryptBlock(input, false);
|
268
|
-
expected = hex2binary(
|
268
|
+
expected = hex2binary("00112233445566778899aabbccddeeff");
|
269
269
|
expect(result).toEqual(expected);
|
270
270
|
});
|
271
271
|
});
|
272
272
|
});
|
273
|
-
describe(
|
274
|
-
it(
|
273
|
+
describe("PDF17Algorithm", function () {
|
274
|
+
it("should correctly check a user key", function () {
|
275
275
|
var password, userValidation, userPassword, alg, result;
|
276
276
|
alg = new _crypto.PDF17();
|
277
277
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -280,7 +280,7 @@ describe('crypto', function () {
|
|
280
280
|
result = alg.checkUserPassword(password, userValidation, userPassword);
|
281
281
|
expect(result).toEqual(true);
|
282
282
|
});
|
283
|
-
it(
|
283
|
+
it("should correctly check an owner key", function () {
|
284
284
|
var password, ownerValidation, ownerPassword, alg, result, uBytes;
|
285
285
|
alg = new _crypto.PDF17();
|
286
286
|
password = new Uint8Array([111, 119, 110, 101, 114]);
|
@@ -290,7 +290,7 @@ describe('crypto', function () {
|
|
290
290
|
result = alg.checkOwnerPassword(password, ownerValidation, uBytes, ownerPassword);
|
291
291
|
expect(result).toEqual(true);
|
292
292
|
});
|
293
|
-
it(
|
293
|
+
it("should generate a file encryption key from the user key", function () {
|
294
294
|
var password, userKeySalt, expected, alg, result, userEncryption;
|
295
295
|
alg = new _crypto.PDF17();
|
296
296
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -300,7 +300,7 @@ describe('crypto', function () {
|
|
300
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]);
|
301
301
|
expect(result).toEqual(expected);
|
302
302
|
});
|
303
|
-
it(
|
303
|
+
it("should generate a file encryption key from the owner key", function () {
|
304
304
|
var password, ownerKeySalt, expected, alg, result, ownerEncryption;
|
305
305
|
var uBytes;
|
306
306
|
alg = new _crypto.PDF17();
|
@@ -313,8 +313,8 @@ describe('crypto', function () {
|
|
313
313
|
expect(result).toEqual(expected);
|
314
314
|
});
|
315
315
|
});
|
316
|
-
describe(
|
317
|
-
it(
|
316
|
+
describe("PDF20Algorithm", function () {
|
317
|
+
it("should correctly check a user key", function () {
|
318
318
|
var password, userValidation, userPassword, alg, result;
|
319
319
|
alg = new _crypto.PDF20();
|
320
320
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -323,7 +323,7 @@ describe('crypto', function () {
|
|
323
323
|
result = alg.checkUserPassword(password, userValidation, userPassword);
|
324
324
|
expect(result).toEqual(true);
|
325
325
|
});
|
326
|
-
it(
|
326
|
+
it("should correctly check an owner key", function () {
|
327
327
|
var password, ownerValidation, ownerPassword, alg, result, uBytes;
|
328
328
|
alg = new _crypto.PDF20();
|
329
329
|
password = new Uint8Array([111, 119, 110, 101, 114]);
|
@@ -333,7 +333,7 @@ describe('crypto', function () {
|
|
333
333
|
result = alg.checkOwnerPassword(password, ownerValidation, uBytes, ownerPassword);
|
334
334
|
expect(result).toEqual(true);
|
335
335
|
});
|
336
|
-
it(
|
336
|
+
it("should generate a file encryption key from the user key", function () {
|
337
337
|
var password, userKeySalt, expected, alg, result, userEncryption;
|
338
338
|
alg = new _crypto.PDF20();
|
339
339
|
password = new Uint8Array([117, 115, 101, 114]);
|
@@ -343,7 +343,7 @@ describe('crypto', function () {
|
|
343
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]);
|
344
344
|
expect(result).toEqual(expected);
|
345
345
|
});
|
346
|
-
it(
|
346
|
+
it("should generate a file encryption key from the owner key", function () {
|
347
347
|
var password, ownerKeySalt, expected, alg, result, ownerEncryption;
|
348
348
|
var uBytes;
|
349
349
|
alg = new _crypto.PDF20();
|
@@ -357,7 +357,7 @@ describe('crypto', function () {
|
|
357
357
|
});
|
358
358
|
});
|
359
359
|
});
|
360
|
-
describe(
|
360
|
+
describe("CipherTransformFactory", function () {
|
361
361
|
function buildDict(map) {
|
362
362
|
var dict = new _primitives.Dict();
|
363
363
|
|
@@ -371,9 +371,9 @@ describe('CipherTransformFactory', function () {
|
|
371
371
|
function ensurePasswordCorrect(done, dict, fileId, password) {
|
372
372
|
try {
|
373
373
|
var factory = new _crypto.CipherTransformFactory(dict, fileId, password);
|
374
|
-
expect(
|
374
|
+
expect("createCipherTransform" in factory).toEqual(true);
|
375
375
|
} catch (ex) {
|
376
|
-
done.fail(
|
376
|
+
done.fail("Password should be accepted: " + ex);
|
377
377
|
return;
|
378
378
|
}
|
379
379
|
|
@@ -390,7 +390,7 @@ describe('CipherTransformFactory', function () {
|
|
390
390
|
return;
|
391
391
|
}
|
392
392
|
|
393
|
-
done.fail(
|
393
|
+
done.fail("Password should be rejected.");
|
394
394
|
}
|
395
395
|
|
396
396
|
function ensurePasswordIncorrect(done, dict, fileId, password) {
|
@@ -403,77 +403,77 @@ describe('CipherTransformFactory', function () {
|
|
403
403
|
return;
|
404
404
|
}
|
405
405
|
|
406
|
-
done.fail(
|
406
|
+
done.fail("Password should be rejected.");
|
407
407
|
}
|
408
408
|
|
409
409
|
var fileId1, fileId2, dict1, dict2;
|
410
410
|
var aes256Dict, aes256IsoDict, aes256BlankDict, aes256IsoBlankDict;
|
411
411
|
beforeAll(function (done) {
|
412
|
-
fileId1 = unescape(
|
413
|
-
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");
|
414
414
|
dict1 = buildDict({
|
415
|
-
Filter: _primitives.Name.get(
|
415
|
+
Filter: _primitives.Name.get("Standard"),
|
416
416
|
V: 2,
|
417
417
|
Length: 128,
|
418
|
-
O: unescape(
|
419
|
-
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"),
|
420
420
|
P: -1028,
|
421
421
|
R: 3
|
422
422
|
});
|
423
423
|
dict2 = buildDict({
|
424
|
-
Filter: _primitives.Name.get(
|
424
|
+
Filter: _primitives.Name.get("Standard"),
|
425
425
|
V: 4,
|
426
426
|
Length: 128,
|
427
|
-
O: unescape(
|
428
|
-
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"),
|
429
429
|
P: -1084,
|
430
430
|
R: 4
|
431
431
|
});
|
432
432
|
aes256Dict = buildDict({
|
433
|
-
Filter: _primitives.Name.get(
|
433
|
+
Filter: _primitives.Name.get("Standard"),
|
434
434
|
V: 5,
|
435
435
|
Length: 256,
|
436
|
-
O: unescape(
|
437
|
-
U: unescape(
|
438
|
-
OE: unescape(
|
439
|
-
UE: unescape(
|
440
|
-
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"),
|
441
441
|
P: -1084,
|
442
442
|
R: 5
|
443
443
|
});
|
444
444
|
aes256IsoDict = buildDict({
|
445
|
-
Filter: _primitives.Name.get(
|
445
|
+
Filter: _primitives.Name.get("Standard"),
|
446
446
|
V: 5,
|
447
447
|
Length: 256,
|
448
|
-
O: unescape(
|
449
|
-
U: unescape(
|
450
|
-
OE: unescape(
|
451
|
-
UE: unescape(
|
452
|
-
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"),
|
453
453
|
P: -1084,
|
454
454
|
R: 6
|
455
455
|
});
|
456
456
|
aes256BlankDict = buildDict({
|
457
|
-
Filter: _primitives.Name.get(
|
457
|
+
Filter: _primitives.Name.get("Standard"),
|
458
458
|
V: 5,
|
459
459
|
Length: 256,
|
460
|
-
O: unescape(
|
461
|
-
U: unescape(
|
462
|
-
OE: unescape(
|
463
|
-
UE: unescape(
|
464
|
-
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"),
|
465
465
|
P: -1084,
|
466
466
|
R: 5
|
467
467
|
});
|
468
468
|
aes256IsoBlankDict = buildDict({
|
469
|
-
Filter: _primitives.Name.get(
|
469
|
+
Filter: _primitives.Name.get("Standard"),
|
470
470
|
V: 5,
|
471
471
|
Length: 256,
|
472
|
-
O: unescape(
|
473
|
-
U: unescape(
|
474
|
-
OE: unescape(
|
475
|
-
UE: unescape(
|
476
|
-
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"),
|
477
477
|
P: -1084,
|
478
478
|
R: 6
|
479
479
|
});
|
@@ -483,54 +483,54 @@ describe('CipherTransformFactory', function () {
|
|
483
483
|
fileId1 = fileId2 = dict1 = dict2 = null;
|
484
484
|
aes256Dict = aes256IsoDict = aes256BlankDict = aes256IsoBlankDict = null;
|
485
485
|
});
|
486
|
-
describe(
|
487
|
-
describe(
|
488
|
-
it(
|
489
|
-
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");
|
490
490
|
});
|
491
|
-
it(
|
492
|
-
ensurePasswordCorrect(done, aes256Dict, fileId1,
|
491
|
+
it("should accept owner password", function (done) {
|
492
|
+
ensurePasswordCorrect(done, aes256Dict, fileId1, "owner");
|
493
493
|
});
|
494
|
-
it(
|
494
|
+
it("should not accept blank password", function (done) {
|
495
495
|
ensurePasswordNeeded(done, aes256Dict, fileId1);
|
496
496
|
});
|
497
|
-
it(
|
498
|
-
ensurePasswordIncorrect(done, aes256Dict, fileId1,
|
497
|
+
it("should not accept wrong password", function (done) {
|
498
|
+
ensurePasswordIncorrect(done, aes256Dict, fileId1, "wrong");
|
499
499
|
});
|
500
|
-
it(
|
500
|
+
it("should accept blank password", function (done) {
|
501
501
|
ensurePasswordCorrect(done, aes256BlankDict, fileId1);
|
502
502
|
});
|
503
503
|
});
|
504
|
-
describe(
|
505
|
-
it(
|
506
|
-
ensurePasswordCorrect(done, aes256IsoDict, fileId1,
|
504
|
+
describe("AES256 Revision 6", function () {
|
505
|
+
it("should accept user password", function (done) {
|
506
|
+
ensurePasswordCorrect(done, aes256IsoDict, fileId1, "user");
|
507
507
|
});
|
508
|
-
it(
|
509
|
-
ensurePasswordCorrect(done, aes256IsoDict, fileId1,
|
508
|
+
it("should accept owner password", function (done) {
|
509
|
+
ensurePasswordCorrect(done, aes256IsoDict, fileId1, "owner");
|
510
510
|
});
|
511
|
-
it(
|
511
|
+
it("should not accept blank password", function (done) {
|
512
512
|
ensurePasswordNeeded(done, aes256IsoDict, fileId1);
|
513
513
|
});
|
514
|
-
it(
|
515
|
-
ensurePasswordIncorrect(done, aes256IsoDict, fileId1,
|
514
|
+
it("should not accept wrong password", function (done) {
|
515
|
+
ensurePasswordIncorrect(done, aes256IsoDict, fileId1, "wrong");
|
516
516
|
});
|
517
|
-
it(
|
517
|
+
it("should accept blank password", function (done) {
|
518
518
|
ensurePasswordCorrect(done, aes256IsoBlankDict, fileId1);
|
519
519
|
});
|
520
520
|
});
|
521
|
-
it(
|
522
|
-
ensurePasswordCorrect(done, dict1, fileId1,
|
521
|
+
it("should accept user password", function (done) {
|
522
|
+
ensurePasswordCorrect(done, dict1, fileId1, "123456");
|
523
523
|
});
|
524
|
-
it(
|
525
|
-
ensurePasswordCorrect(done, dict1, fileId1,
|
524
|
+
it("should accept owner password", function (done) {
|
525
|
+
ensurePasswordCorrect(done, dict1, fileId1, "654321");
|
526
526
|
});
|
527
|
-
it(
|
527
|
+
it("should not accept blank password", function (done) {
|
528
528
|
ensurePasswordNeeded(done, dict1, fileId1);
|
529
529
|
});
|
530
|
-
it(
|
531
|
-
ensurePasswordIncorrect(done, dict1, fileId1,
|
530
|
+
it("should not accept wrong password", function (done) {
|
531
|
+
ensurePasswordIncorrect(done, dict1, fileId1, "wrong");
|
532
532
|
});
|
533
|
-
it(
|
533
|
+
it("should accept blank password", function (done) {
|
534
534
|
ensurePasswordCorrect(done, dict2, fileId2);
|
535
535
|
});
|
536
536
|
});
|