1 | /* | |
2 | * $Id: PdfEncryption.java 4065 2009-09-16 23:09:11Z psoares33 $ | |
3 | * | |
4 | * Copyright 2001-2006 Paulo Soares | |
5 | * | |
6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
7 | * (the "License"); you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
9 | * | |
10 | * Software distributed under the License is distributed on an "AS IS" basis, | |
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 | * for the specific language governing rights and limitations under the License. | |
13 | * | |
14 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
15 | * | |
16 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
17 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
18 | * All Rights Reserved. | |
19 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
20 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
21 | * | |
22 | * Contributor(s): all the names of the contributors are added in the source code | |
23 | * where applicable. | |
24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of the | |
26 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
27 | * provisions of LGPL are applicable instead of those above. If you wish to | |
28 | * allow use of your version of this file only under the terms of the LGPL | |
29 | * License and not to allow others to use your version of this file under | |
30 | * the MPL, indicate your decision by deleting the provisions above and | |
31 | * replace them with the notice and other provisions required by the LGPL. | |
32 | * If you do not delete the provisions above, a recipient may use your version | |
33 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
34 | * | |
35 | * This library is free software; you can redistribute it and/or modify it | |
36 | * under the terms of the MPL as stated above or under the terms of the GNU | |
37 | * Library General Public License as published by the Free Software Foundation; | |
38 | * either version 2 of the License, or any later version. | |
39 | * | |
40 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
41 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
42 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
43 | * details. | |
44 | * | |
45 | * If you didn't download this code from the following link, you should check if | |
46 | * you aren't using an obsolete version: | |
47 | * http://www.lowagie.com/iText/ | |
48 | */ | |
49 | ||
50 | package com.lowagie.text.pdf; | |
51 | ||
52 | import com.lowagie.text.ExceptionConverter; | |
53 | import com.lowagie.text.pdf.crypto.ARCFOUREncryption; | |
54 | import com.lowagie.text.error_messages.MessageLocalization; | |
55 | ||
56 | import java.io.IOException; | |
57 | import java.io.OutputStream; | |
58 | import java.io.ByteArrayOutputStream; | |
59 | import java.security.MessageDigest; | |
60 | import java.security.cert.Certificate; | |
61 | ||
62 | ||
63 | ||
64 | /** | |
65 | * | |
66 | * @author Paulo Soares (psoares@consiste.pt) | |
67 | * @author Kazuya Ujihara | |
68 | */ | |
69 | public class PdfEncryption { | |
70 | ||
71 | public static final int STANDARD_ENCRYPTION_40 = 2; | |
72 | ||
73 | public static final int STANDARD_ENCRYPTION_128 = 3; | |
74 | ||
75 | public static final int AES_128 = 4; | |
76 | ||
77 | private static final byte[] pad = { (byte) 0x28, (byte) 0xBF, (byte) 0x4E, | |
78 | (byte) 0x5E, (byte) 0x4E, (byte) 0x75, (byte) 0x8A, (byte) 0x41, | |
79 | (byte) 0x64, (byte) 0x00, (byte) 0x4E, (byte) 0x56, (byte) 0xFF, | |
80 | (byte) 0xFA, (byte) 0x01, (byte) 0x08, (byte) 0x2E, (byte) 0x2E, | |
81 | (byte) 0x00, (byte) 0xB6, (byte) 0xD0, (byte) 0x68, (byte) 0x3E, | |
82 | (byte) 0x80, (byte) 0x2F, (byte) 0x0C, (byte) 0xA9, (byte) 0xFE, | |
83 | (byte) 0x64, (byte) 0x53, (byte) 0x69, (byte) 0x7A }; | |
84 | ||
85 | private static final byte[] salt = { (byte) 0x73, (byte) 0x41, (byte) 0x6c, | |
86 | (byte) 0x54 }; | |
87 | ||
88 | private static final byte[] metadataPad = { (byte) 255, (byte) 255, | |
89 | (byte) 255, (byte) 255 }; | |
90 | ||
91 | /** | |
92 | * The encryption key for a particular object/generation | |
93 | */ | |
94 | byte[] key; | |
95 | ||
96 | /** The encryption key length for a particular object/generation */ | |
97 | int keySize; | |
98 | ||
99 | /** | |
100 | * The global encryption key | |
101 | */ | |
102 | byte[] mkey; | |
103 | ||
104 | /** | |
105 | * Work area to prepare the object/generation bytes | |
106 | */ | |
107 | byte[] extra = new byte[5]; | |
108 | ||
109 | /** The message digest algorithm MD5 */ | |
110 | MessageDigest md5; | |
111 | ||
112 | /** | |
113 | * The encryption key for the owner | |
114 | */ | |
115 | byte[] ownerKey = new byte[32]; | |
116 | ||
117 | /** | |
118 | * The encryption key for the user | |
119 | */ | |
120 | byte[] userKey = new byte[32]; | |
121 | ||
122 | /** The public key security handler for certificate encryption */ | |
123 | protected PdfPublicKeySecurityHandler publicKeyHandler = null; | |
124 | ||
125 | int permissions; | |
126 | ||
127 | byte[] documentID; | |
128 | ||
129 | static long seq = System.currentTimeMillis(); | |
130 | ||
131 | private int revision; | |
132 | ||
133 | private ARCFOUREncryption arcfour = new ARCFOUREncryption(); | |
134 | ||
135 | /** The generic key length. It may be 40 or 128. */ | |
136 | private int keyLength; | |
137 | ||
138 | private boolean encryptMetadata; | |
139 | | |
140 | /** | |
141 | * Indicates if the encryption is only necessary for embedded files. | |
142 | * @since 2.1.3 | |
143 | */ | |
144 | private boolean embeddedFilesOnly; | |
145 | ||
146 | private int cryptoMode; | |
147 | ||
148 | public PdfEncryption() { | |
149 | try { | |
150 | md5 = MessageDigest.getInstance("MD5"); | |
151 | } catch (Exception e) { | |
152 | throw new ExceptionConverter(e); | |
153 | } | |
154 | publicKeyHandler = new PdfPublicKeySecurityHandler(); | |
155 | } | |
156 | ||
157 | public PdfEncryption(PdfEncryption enc) { | |
158 | this(); | |
159 | mkey = enc.mkey.clone(); | |
160 | ownerKey = enc.ownerKey.clone(); | |
161 | userKey = enc.userKey.clone(); | |
162 | permissions = enc.permissions; | |
163 |
1
1. |
if (enc.documentID != null) |
164 | documentID = enc.documentID.clone(); | |
165 | revision = enc.revision; | |
166 | keyLength = enc.keyLength; | |
167 | encryptMetadata = enc.encryptMetadata; | |
168 | embeddedFilesOnly = enc.embeddedFilesOnly; | |
169 | publicKeyHandler = enc.publicKeyHandler; | |
170 | } | |
171 | ||
172 | public void setCryptoMode(int mode, int kl) { | |
173 | cryptoMode = mode; | |
174 |
2
1. setCryptoMode : Replaced bitwise AND with OR → NO_COVERAGE 2. setCryptoMode : negated conditional → NO_COVERAGE |
encryptMetadata = (mode & PdfWriter.DO_NOT_ENCRYPT_METADATA) == 0; |
175 |
2
1. setCryptoMode : Replaced bitwise AND with OR → NO_COVERAGE 2. setCryptoMode : negated conditional → NO_COVERAGE |
embeddedFilesOnly = (mode & PdfWriter.EMBEDDED_FILES_ONLY) != 0; |
176 |
1
1. setCryptoMode : Replaced bitwise AND with OR → NO_COVERAGE |
mode &= PdfWriter.ENCRYPTION_MASK; |
177 | switch (mode) { | |
178 | case PdfWriter.STANDARD_ENCRYPTION_40: | |
179 | encryptMetadata = true; | |
180 | embeddedFilesOnly = false; | |
181 | keyLength = 40; | |
182 | revision = STANDARD_ENCRYPTION_40; | |
183 | break; | |
184 | case PdfWriter.STANDARD_ENCRYPTION_128: | |
185 | embeddedFilesOnly = false; | |
186 |
2
1. setCryptoMode : changed conditional boundary → NO_COVERAGE 2. setCryptoMode : negated conditional → NO_COVERAGE |
if (kl > 0) |
187 | keyLength = kl; | |
188 | else | |
189 | keyLength = 128; | |
190 | revision = STANDARD_ENCRYPTION_128; | |
191 | break; | |
192 | case PdfWriter.ENCRYPTION_AES_128: | |
193 | keyLength = 128; | |
194 | revision = AES_128; | |
195 | break; | |
196 | default: | |
197 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("no.valid.encryption.mode")); | |
198 | } | |
199 | } | |
200 | ||
201 | public int getCryptoMode() { | |
202 | return cryptoMode; | |
203 | } | |
204 | ||
205 | public boolean isMetadataEncrypted() { | |
206 | return encryptMetadata; | |
207 | } | |
208 | ||
209 | /** | |
210 | * Indicates if only the embedded files have to be encrypted. | |
211 | * @return if true only the embedded files will be encrypted | |
212 | * @since 2.1.3 | |
213 | */ | |
214 | public boolean isEmbeddedFilesOnly() { | |
215 | return embeddedFilesOnly; | |
216 | } | |
217 | ||
218 | /** | |
219 | */ | |
220 | private byte[] padPassword(byte[] userPassword) { | |
221 | byte[] userPad = new byte[32]; | |
222 |
1
1. padPassword : negated conditional → NO_COVERAGE |
if (userPassword == null) { |
223 |
1
1. padPassword : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(pad, 0, userPad, 0, 32); |
224 | } else { | |
225 |
1
1. padPassword : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(userPassword, 0, userPad, 0, Math.min( |
226 | userPassword.length, 32)); | |
227 |
2
1. padPassword : changed conditional boundary → NO_COVERAGE 2. padPassword : negated conditional → NO_COVERAGE |
if (userPassword.length < 32) |
228 |
2
1. padPassword : Replaced integer subtraction with addition → NO_COVERAGE 2. padPassword : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(pad, 0, userPad, userPassword.length, |
229 | 32 - userPassword.length); | |
230 | } | |
231 | ||
232 |
1
1. padPassword : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::padPassword to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return userPad; |
233 | } | |
234 | ||
235 | /** | |
236 | */ | |
237 | private byte[] computeOwnerKey(byte[] userPad, byte[] ownerPad) { | |
238 | byte[] ownerKey = new byte[32]; | |
239 | ||
240 | byte[] digest = md5.digest(ownerPad); | |
241 |
2
1. computeOwnerKey : negated conditional → NO_COVERAGE 2. computeOwnerKey : negated conditional → NO_COVERAGE |
if (revision == STANDARD_ENCRYPTION_128 || revision == AES_128) { |
242 |
1
1. computeOwnerKey : Replaced integer division with multiplication → NO_COVERAGE |
byte[] mkey = new byte[keyLength / 8]; |
243 | // only use for the input as many bit as the key consists of | |
244 |
2
1. computeOwnerKey : changed conditional boundary → NO_COVERAGE 2. computeOwnerKey : negated conditional → NO_COVERAGE |
for (int k = 0; k < 50; ++k) |
245 |
1
1. computeOwnerKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(md5.digest(digest), 0, digest, 0, mkey.length); |
246 |
1
1. computeOwnerKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(userPad, 0, ownerKey, 0, 32); |
247 |
3
1. computeOwnerKey : changed conditional boundary → NO_COVERAGE 2. computeOwnerKey : Changed increment from 1 to -1 → NO_COVERAGE 3. computeOwnerKey : negated conditional → NO_COVERAGE |
for (int i = 0; i < 20; ++i) { |
248 |
2
1. computeOwnerKey : changed conditional boundary → NO_COVERAGE 2. computeOwnerKey : negated conditional → NO_COVERAGE |
for (int j = 0; j < mkey.length; ++j) |
249 |
1
1. computeOwnerKey : Replaced XOR with AND → NO_COVERAGE |
mkey[j] = (byte) (digest[j] ^ i); |
250 |
1
1. computeOwnerKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::prepareARCFOURKey → NO_COVERAGE |
arcfour.prepareARCFOURKey(mkey); |
251 |
1
1. computeOwnerKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::encryptARCFOUR → NO_COVERAGE |
arcfour.encryptARCFOUR(ownerKey); |
252 | } | |
253 | } else { | |
254 |
1
1. computeOwnerKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::prepareARCFOURKey → NO_COVERAGE |
arcfour.prepareARCFOURKey(digest, 0, 5); |
255 |
1
1. computeOwnerKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::encryptARCFOUR → NO_COVERAGE |
arcfour.encryptARCFOUR(userPad, ownerKey); |
256 | } | |
257 | ||
258 |
1
1. computeOwnerKey : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::computeOwnerKey to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ownerKey; |
259 | } | |
260 | ||
261 | /** | |
262 | * | |
263 | * ownerKey, documentID must be setup | |
264 | */ | |
265 | private void setupGlobalEncryptionKey(byte[] documentID, byte[] userPad, | |
266 | byte[] ownerKey, int permissions) { | |
267 | this.documentID = documentID; | |
268 | this.ownerKey = ownerKey; | |
269 | this.permissions = permissions; | |
270 | // use variable keylength | |
271 |
1
1. setupGlobalEncryptionKey : Replaced integer division with multiplication → NO_COVERAGE |
mkey = new byte[keyLength / 8]; |
272 | ||
273 | // fixed by ujihara in order to follow PDF reference | |
274 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::reset → NO_COVERAGE |
md5.reset(); |
275 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(userPad); |
276 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(ownerKey); |
277 | ||
278 | byte[] ext = new byte[4]; | |
279 | ext[0] = (byte) permissions; | |
280 |
1
1. setupGlobalEncryptionKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
ext[1] = (byte) (permissions >> 8); |
281 |
1
1. setupGlobalEncryptionKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
ext[2] = (byte) (permissions >> 16); |
282 |
1
1. setupGlobalEncryptionKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
ext[3] = (byte) (permissions >> 24); |
283 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(ext, 0, 4); |
284 |
1
1. setupGlobalEncryptionKey : negated conditional → NO_COVERAGE |
if (documentID != null) |
285 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(documentID); |
286 |
1
1. setupGlobalEncryptionKey : negated conditional → NO_COVERAGE |
if (!encryptMetadata) |
287 |
1
1. setupGlobalEncryptionKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(metadataPad); |
288 | ||
289 | byte[] digest = new byte[mkey.length]; | |
290 |
1
1. setupGlobalEncryptionKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(md5.digest(), 0, digest, 0, mkey.length); |
291 | ||
292 | // only use the really needed bits as input for the hash | |
293 |
2
1. setupGlobalEncryptionKey : negated conditional → NO_COVERAGE 2. setupGlobalEncryptionKey : negated conditional → NO_COVERAGE |
if (revision == STANDARD_ENCRYPTION_128 || revision == AES_128) { |
294 |
2
1. setupGlobalEncryptionKey : changed conditional boundary → NO_COVERAGE 2. setupGlobalEncryptionKey : negated conditional → NO_COVERAGE |
for (int k = 0; k < 50; ++k) |
295 |
1
1. setupGlobalEncryptionKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(md5.digest(digest), 0, digest, 0, mkey.length); |
296 | } | |
297 | ||
298 |
1
1. setupGlobalEncryptionKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(digest, 0, mkey, 0, mkey.length); |
299 | } | |
300 | ||
301 | /** | |
302 | * | |
303 | * mkey must be setup | |
304 | */ | |
305 | // use the revision to choose the setup method | |
306 | private void setupUserKey() { | |
307 |
2
1. setupUserKey : negated conditional → NO_COVERAGE 2. setupUserKey : negated conditional → NO_COVERAGE |
if (revision == STANDARD_ENCRYPTION_128 || revision == AES_128) { |
308 |
1
1. setupUserKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(pad); |
309 | byte[] digest = md5.digest(documentID); | |
310 |
1
1. setupUserKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(digest, 0, userKey, 0, 16); |
311 |
2
1. setupUserKey : changed conditional boundary → NO_COVERAGE 2. setupUserKey : negated conditional → NO_COVERAGE |
for (int k = 16; k < 32; ++k) |
312 | userKey[k] = 0; | |
313 |
3
1. setupUserKey : changed conditional boundary → NO_COVERAGE 2. setupUserKey : Changed increment from 1 to -1 → NO_COVERAGE 3. setupUserKey : negated conditional → NO_COVERAGE |
for (int i = 0; i < 20; ++i) { |
314 |
2
1. setupUserKey : changed conditional boundary → NO_COVERAGE 2. setupUserKey : negated conditional → NO_COVERAGE |
for (int j = 0; j < mkey.length; ++j) |
315 |
1
1. setupUserKey : Replaced XOR with AND → NO_COVERAGE |
digest[j] = (byte) (mkey[j] ^ i); |
316 |
1
1. setupUserKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::prepareARCFOURKey → NO_COVERAGE |
arcfour.prepareARCFOURKey(digest, 0, mkey.length); |
317 |
1
1. setupUserKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::encryptARCFOUR → NO_COVERAGE |
arcfour.encryptARCFOUR(userKey, 0, 16); |
318 | } | |
319 | } else { | |
320 |
1
1. setupUserKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::prepareARCFOURKey → NO_COVERAGE |
arcfour.prepareARCFOURKey(mkey); |
321 |
1
1. setupUserKey : removed call to com/lowagie/text/pdf/crypto/ARCFOUREncryption::encryptARCFOUR → NO_COVERAGE |
arcfour.encryptARCFOUR(pad, userKey); |
322 | } | |
323 | } | |
324 | ||
325 | // gets keylength and revision and uses revision to choose the initial values | |
326 | // for permissions | |
327 | public void setupAllKeys(byte[] userPassword, byte[] ownerPassword, | |
328 | int permissions) { | |
329 |
2
1. setupAllKeys : negated conditional → NO_COVERAGE 2. setupAllKeys : negated conditional → NO_COVERAGE |
if (ownerPassword == null || ownerPassword.length == 0) |
330 | ownerPassword = md5.digest(createDocumentId()); | |
331 |
3
1. setupAllKeys : Replaced bitwise OR with AND → NO_COVERAGE 2. setupAllKeys : negated conditional → NO_COVERAGE 3. setupAllKeys : negated conditional → NO_COVERAGE |
permissions |= (revision == STANDARD_ENCRYPTION_128 || revision == AES_128) ? 0xfffff0c0 |
332 | : 0xffffffc0; | |
333 |
1
1. setupAllKeys : Replaced bitwise AND with OR → NO_COVERAGE |
permissions &= 0xfffffffc; |
334 | // PDF reference 3.5.2 Standard Security Handler, Algorithm 3.3-1 | |
335 | // If there is no owner password, use the user password instead. | |
336 | byte[] userPad = padPassword(userPassword); | |
337 | byte[] ownerPad = padPassword(ownerPassword); | |
338 | ||
339 | this.ownerKey = computeOwnerKey(userPad, ownerPad); | |
340 | documentID = createDocumentId(); | |
341 |
1
1. setupAllKeys : removed call to com/lowagie/text/pdf/PdfEncryption::setupByUserPad → NO_COVERAGE |
setupByUserPad(this.documentID, userPad, this.ownerKey, permissions); |
342 | } | |
343 | ||
344 | public static byte[] createDocumentId() { | |
345 | MessageDigest md5; | |
346 | try { | |
347 | md5 = MessageDigest.getInstance("MD5"); | |
348 | } catch (Exception e) { | |
349 | throw new ExceptionConverter(e); | |
350 | } | |
351 | long time = System.currentTimeMillis(); | |
352 | long mem = Runtime.getRuntime().freeMemory(); | |
353 |
1
1. createDocumentId : Replaced long addition with subtraction → NO_COVERAGE |
String s = time + "+" + mem + "+" + (seq++); |
354 |
1
1. createDocumentId : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::createDocumentId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return md5.digest(s.getBytes()); |
355 | } | |
356 | ||
357 | /** | |
358 | */ | |
359 | public void setupByUserPassword(byte[] documentID, byte[] userPassword, | |
360 | byte[] ownerKey, int permissions) { | |
361 |
1
1. setupByUserPassword : removed call to com/lowagie/text/pdf/PdfEncryption::setupByUserPad → NO_COVERAGE |
setupByUserPad(documentID, padPassword(userPassword), ownerKey, |
362 | permissions); | |
363 | } | |
364 | ||
365 | /** | |
366 | */ | |
367 | private void setupByUserPad(byte[] documentID, byte[] userPad, | |
368 | byte[] ownerKey, int permissions) { | |
369 |
1
1. setupByUserPad : removed call to com/lowagie/text/pdf/PdfEncryption::setupGlobalEncryptionKey → NO_COVERAGE |
setupGlobalEncryptionKey(documentID, userPad, ownerKey, permissions); |
370 |
1
1. setupByUserPad : removed call to com/lowagie/text/pdf/PdfEncryption::setupUserKey → NO_COVERAGE |
setupUserKey(); |
371 | } | |
372 | ||
373 | /** | |
374 | */ | |
375 | public void setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, | |
376 | byte[] userKey, byte[] ownerKey, int permissions) { | |
377 |
1
1. setupByOwnerPassword : removed call to com/lowagie/text/pdf/PdfEncryption::setupByOwnerPad → NO_COVERAGE |
setupByOwnerPad(documentID, padPassword(ownerPassword), userKey, |
378 | ownerKey, permissions); | |
379 | } | |
380 | ||
381 | private void setupByOwnerPad(byte[] documentID, byte[] ownerPad, | |
382 | byte[] userKey, byte[] ownerKey, int permissions) { | |
383 | byte[] userPad = computeOwnerKey(ownerKey, ownerPad); // userPad will | |
384 | // be set in | |
385 | // this.ownerKey | |
386 |
1
1. setupByOwnerPad : removed call to com/lowagie/text/pdf/PdfEncryption::setupGlobalEncryptionKey → NO_COVERAGE |
setupGlobalEncryptionKey(documentID, userPad, ownerKey, permissions); // step |
387 | // 3 | |
388 |
1
1. setupByOwnerPad : removed call to com/lowagie/text/pdf/PdfEncryption::setupUserKey → NO_COVERAGE |
setupUserKey(); |
389 | } | |
390 | ||
391 | public void setupByEncryptionKey(byte[] key, int keylength) { | |
392 |
1
1. setupByEncryptionKey : Replaced integer division with multiplication → NO_COVERAGE |
mkey = new byte[keylength / 8]; |
393 |
1
1. setupByEncryptionKey : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(key, 0, mkey, 0, mkey.length); |
394 | } | |
395 | ||
396 | public void setHashKey(int number, int generation) { | |
397 |
1
1. setHashKey : removed call to java/security/MessageDigest::reset → NO_COVERAGE |
md5.reset(); // added by ujihara |
398 | extra[0] = (byte) number; | |
399 |
1
1. setHashKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
extra[1] = (byte) (number >> 8); |
400 |
1
1. setHashKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
extra[2] = (byte) (number >> 16); |
401 | extra[3] = (byte) generation; | |
402 |
1
1. setHashKey : Replaced Shift Right with Shift Left → NO_COVERAGE |
extra[4] = (byte) (generation >> 8); |
403 |
1
1. setHashKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(mkey); |
404 |
1
1. setHashKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(extra); |
405 |
1
1. setHashKey : negated conditional → NO_COVERAGE |
if (revision == AES_128) |
406 |
1
1. setHashKey : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md5.update(salt); |
407 | key = md5.digest(); | |
408 |
1
1. setHashKey : Replaced integer addition with subtraction → NO_COVERAGE |
keySize = mkey.length + 5; |
409 |
2
1. setHashKey : changed conditional boundary → NO_COVERAGE 2. setHashKey : negated conditional → NO_COVERAGE |
if (keySize > 16) |
410 | keySize = 16; | |
411 | } | |
412 | ||
413 | public static PdfObject createInfoId(byte[] id) { | |
414 | ByteBuffer buf = new ByteBuffer(90); | |
415 | buf.append('[').append('<'); | |
416 |
2
1. createInfoId : changed conditional boundary → NO_COVERAGE 2. createInfoId : negated conditional → NO_COVERAGE |
for (int k = 0; k < 16; ++k) |
417 | buf.appendHex(id[k]); | |
418 | buf.append('>').append('<'); | |
419 | id = createDocumentId(); | |
420 |
2
1. createInfoId : changed conditional boundary → NO_COVERAGE 2. createInfoId : negated conditional → NO_COVERAGE |
for (int k = 0; k < 16; ++k) |
421 | buf.appendHex(id[k]); | |
422 | buf.append('>').append(']'); | |
423 |
1
1. createInfoId : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::createInfoId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new PdfLiteral(buf.toByteArray()); |
424 | } | |
425 | ||
426 | public PdfDictionary getEncryptionDictionary() { | |
427 | PdfDictionary dic = new PdfDictionary(); | |
428 | ||
429 |
2
1. getEncryptionDictionary : changed conditional boundary → NO_COVERAGE 2. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (publicKeyHandler.getRecipientsSize() > 0) { |
430 | PdfArray recipients = null; | |
431 | ||
432 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.FILTER, PdfName.PUBSEC); |
433 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.R, new PdfNumber(revision)); |
434 | ||
435 | try { | |
436 | recipients = publicKeyHandler.getEncodedRecipients(); | |
437 | } catch (Exception f) { | |
438 | throw new ExceptionConverter(f); | |
439 | } | |
440 | ||
441 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (revision == STANDARD_ENCRYPTION_40) { |
442 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(1)); |
443 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.SUBFILTER, PdfName.ADBE_PKCS7_S4); |
444 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.RECIPIENTS, recipients); |
445 |
2
1. getEncryptionDictionary : negated conditional → NO_COVERAGE 2. getEncryptionDictionary : negated conditional → NO_COVERAGE |
} else if (revision == STANDARD_ENCRYPTION_128 && encryptMetadata) { |
446 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(2)); |
447 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.LENGTH, new PdfNumber(128)); |
448 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.SUBFILTER, PdfName.ADBE_PKCS7_S4); |
449 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.RECIPIENTS, recipients); |
450 | } else { | |
451 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.R, new PdfNumber(AES_128)); |
452 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(4)); |
453 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.SUBFILTER, PdfName.ADBE_PKCS7_S5); |
454 | ||
455 | PdfDictionary stdcf = new PdfDictionary(); | |
456 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.RECIPIENTS, recipients); |
457 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (!encryptMetadata) |
458 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.ENCRYPTMETADATA, PdfBoolean.PDFFALSE); |
459 | ||
460 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (revision == AES_128) |
461 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.CFM, PdfName.AESV2); |
462 | else | |
463 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.CFM, PdfName.V2); |
464 | PdfDictionary cf = new PdfDictionary(); | |
465 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
cf.put(PdfName.DEFAULTCRYPTFILTER, stdcf); |
466 |
2
1. getEncryptionDictionary : negated conditional → NO_COVERAGE 2. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.CF, cf);if (embeddedFilesOnly) { |
467 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.EFF, PdfName.DEFAULTCRYPTFILTER); |
468 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STRF, PdfName.IDENTITY); |
469 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STMF, PdfName.IDENTITY); |
470 | } | |
471 | else { | |
472 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STRF, PdfName.DEFAULTCRYPTFILTER); |
473 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STMF, PdfName.DEFAULTCRYPTFILTER); |
474 | } | |
475 | } | |
476 | ||
477 | MessageDigest md = null; | |
478 | byte[] encodedRecipient = null; | |
479 | ||
480 | try { | |
481 | md = MessageDigest.getInstance("SHA-1"); | |
482 |
1
1. getEncryptionDictionary : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md.update(publicKeyHandler.getSeed()); |
483 |
2
1. getEncryptionDictionary : changed conditional boundary → NO_COVERAGE 2. getEncryptionDictionary : negated conditional → NO_COVERAGE |
for (int i = 0; i < publicKeyHandler.getRecipientsSize(); i++) { |
484 | encodedRecipient = publicKeyHandler.getEncodedRecipient(i); | |
485 |
1
1. getEncryptionDictionary : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md.update(encodedRecipient); |
486 | } | |
487 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (!encryptMetadata) |
488 |
1
1. getEncryptionDictionary : removed call to java/security/MessageDigest::update → NO_COVERAGE |
md.update(new byte[] { (byte) 255, (byte) 255, (byte) 255, |
489 | (byte) 255 }); | |
490 | } catch (Exception f) { | |
491 | throw new ExceptionConverter(f); | |
492 | } | |
493 | ||
494 | byte[] mdResult = md.digest(); | |
495 | ||
496 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfEncryption::setupByEncryptionKey → NO_COVERAGE |
setupByEncryptionKey(mdResult, keyLength); |
497 | } else { | |
498 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.FILTER, PdfName.STANDARD); |
499 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.O, new PdfLiteral(PdfContentByte |
500 | .escapeString(ownerKey))); | |
501 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.U, new PdfLiteral(PdfContentByte |
502 | .escapeString(userKey))); | |
503 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.P, new PdfNumber(permissions)); |
504 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.R, new PdfNumber(revision)); |
505 | ||
506 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (revision == STANDARD_ENCRYPTION_40) { |
507 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(1)); |
508 |
2
1. getEncryptionDictionary : negated conditional → NO_COVERAGE 2. getEncryptionDictionary : negated conditional → NO_COVERAGE |
} else if (revision == STANDARD_ENCRYPTION_128 && encryptMetadata) { |
509 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(2)); |
510 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.LENGTH, new PdfNumber(128)); |
511 | ||
512 | } else { | |
513 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (!encryptMetadata) |
514 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.ENCRYPTMETADATA, PdfBoolean.PDFFALSE); |
515 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.R, new PdfNumber(AES_128)); |
516 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.V, new PdfNumber(4)); |
517 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.LENGTH, new PdfNumber(128)); |
518 | PdfDictionary stdcf = new PdfDictionary(); | |
519 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.LENGTH, new PdfNumber(16)); |
520 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (embeddedFilesOnly) { |
521 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.AUTHEVENT, PdfName.EFOPEN); |
522 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.EFF, PdfName.STDCF); |
523 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STRF, PdfName.IDENTITY); |
524 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STMF, PdfName.IDENTITY); |
525 | } | |
526 | else { | |
527 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.AUTHEVENT, PdfName.DOCOPEN); |
528 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STRF, PdfName.STDCF); |
529 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.STMF, PdfName.STDCF); |
530 | } | |
531 |
1
1. getEncryptionDictionary : negated conditional → NO_COVERAGE |
if (revision == AES_128) |
532 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.CFM, PdfName.AESV2); |
533 | else | |
534 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
stdcf.put(PdfName.CFM, PdfName.V2); |
535 | PdfDictionary cf = new PdfDictionary(); | |
536 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
cf.put(PdfName.STDCF, stdcf); |
537 |
1
1. getEncryptionDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
dic.put(PdfName.CF, cf); |
538 | } | |
539 | } | |
540 | ||
541 |
1
1. getEncryptionDictionary : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::getEncryptionDictionary to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return dic; |
542 | } | |
543 | ||
544 | public PdfObject getFileID() { | |
545 |
1
1. getFileID : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::getFileID to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return createInfoId(documentID); |
546 | } | |
547 | ||
548 | public OutputStreamEncryption getEncryptionStream(OutputStream os) { | |
549 |
1
1. getEncryptionStream : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::getEncryptionStream to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new OutputStreamEncryption(os, key, 0, keySize, revision); |
550 | } | |
551 | ||
552 | public int calculateStreamSize(int n) { | |
553 |
1
1. calculateStreamSize : negated conditional → NO_COVERAGE |
if (revision == AES_128) |
554 |
3
1. calculateStreamSize : Replaced bitwise AND with OR → NO_COVERAGE 2. calculateStreamSize : Replaced integer addition with subtraction → NO_COVERAGE 3. calculateStreamSize : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (n & 0x7ffffff0) + 32; |
555 | else | |
556 |
1
1. calculateStreamSize : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return n; |
557 | } | |
558 | ||
559 | public byte[] encryptByteArray(byte[] b) { | |
560 | try { | |
561 | ByteArrayOutputStream ba = new ByteArrayOutputStream(); | |
562 | OutputStreamEncryption os2 = getEncryptionStream(ba); | |
563 |
1
1. encryptByteArray : removed call to com/lowagie/text/pdf/OutputStreamEncryption::write → NO_COVERAGE |
os2.write(b); |
564 |
1
1. encryptByteArray : removed call to com/lowagie/text/pdf/OutputStreamEncryption::finish → NO_COVERAGE |
os2.finish(); |
565 |
1
1. encryptByteArray : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::encryptByteArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ba.toByteArray(); |
566 | } catch (IOException ex) { | |
567 | throw new ExceptionConverter(ex); | |
568 | } | |
569 | } | |
570 | ||
571 | public StandardDecryption getDecryptor() { | |
572 |
1
1. getDecryptor : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::getDecryptor to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new StandardDecryption(key, 0, keySize, revision); |
573 | } | |
574 | ||
575 | public byte[] decryptByteArray(byte[] b) { | |
576 | try { | |
577 | ByteArrayOutputStream ba = new ByteArrayOutputStream(); | |
578 | StandardDecryption dec = getDecryptor(); | |
579 | byte[] b2 = dec.update(b, 0, b.length); | |
580 |
1
1. decryptByteArray : negated conditional → NO_COVERAGE |
if (b2 != null) |
581 |
1
1. decryptByteArray : removed call to java/io/ByteArrayOutputStream::write → NO_COVERAGE |
ba.write(b2); |
582 | b2 = dec.finish(); | |
583 |
1
1. decryptByteArray : negated conditional → NO_COVERAGE |
if (b2 != null) |
584 |
1
1. decryptByteArray : removed call to java/io/ByteArrayOutputStream::write → NO_COVERAGE |
ba.write(b2); |
585 |
1
1. decryptByteArray : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::decryptByteArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ba.toByteArray(); |
586 | } catch (IOException ex) { | |
587 | throw new ExceptionConverter(ex); | |
588 | } | |
589 | } | |
590 | ||
591 | public void addRecipient(Certificate cert, int permission) { | |
592 | documentID = createDocumentId(); | |
593 |
1
1. addRecipient : removed call to com/lowagie/text/pdf/PdfPublicKeySecurityHandler::addRecipient → NO_COVERAGE |
publicKeyHandler.addRecipient(new PdfPublicKeyRecipient(cert, |
594 | permission)); | |
595 | } | |
596 | ||
597 | public byte[] computeUserPassword(byte[] ownerPassword) { | |
598 | byte[] userPad = computeOwnerKey(ownerKey, padPassword(ownerPassword)); | |
599 |
3
1. computeUserPassword : changed conditional boundary → NO_COVERAGE 2. computeUserPassword : Changed increment from 1 to -1 → NO_COVERAGE 3. computeUserPassword : negated conditional → NO_COVERAGE |
for (int i = 0; i < userPad.length; i++) { |
600 | boolean match = true; | |
601 |
4
1. computeUserPassword : changed conditional boundary → NO_COVERAGE 2. computeUserPassword : Changed increment from 1 to -1 → NO_COVERAGE 3. computeUserPassword : Replaced integer subtraction with addition → NO_COVERAGE 4. computeUserPassword : negated conditional → NO_COVERAGE |
for (int j = 0; j < userPad.length - i; j++) { |
602 |
2
1. computeUserPassword : Replaced integer addition with subtraction → NO_COVERAGE 2. computeUserPassword : negated conditional → NO_COVERAGE |
if (userPad[i + j] != pad[j]) { |
603 | match = false; | |
604 | break; | |
605 | } | |
606 | } | |
607 |
1
1. computeUserPassword : negated conditional → NO_COVERAGE |
if (!match) continue; |
608 | byte[] userPassword = new byte[i]; | |
609 |
1
1. computeUserPassword : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(userPad, 0, userPassword, 0, i); |
610 |
1
1. computeUserPassword : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::computeUserPassword to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return userPassword; |
611 | } | |
612 |
1
1. computeUserPassword : mutated return of Object value for com/lowagie/text/pdf/PdfEncryption::computeUserPassword to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return userPad; |
613 | } | |
614 | } | |
Mutations | ||
163 |
1.1 |
|
174 |
1.1 2.2 |
|
175 |
1.1 2.2 |
|
176 |
1.1 |
|
186 |
1.1 2.2 |
|
222 |
1.1 |
|
223 |
1.1 |
|
225 |
1.1 |
|
227 |
1.1 2.2 |
|
228 |
1.1 2.2 |
|
232 |
1.1 |
|
241 |
1.1 2.2 |
|
242 |
1.1 |
|
244 |
1.1 2.2 |
|
245 |
1.1 |
|
246 |
1.1 |
|
247 |
1.1 2.2 3.3 |
|
248 |
1.1 2.2 |
|
249 |
1.1 |
|
250 |
1.1 |
|
251 |
1.1 |
|
254 |
1.1 |
|
255 |
1.1 |
|
258 |
1.1 |
|
271 |
1.1 |
|
274 |
1.1 |
|
275 |
1.1 |
|
276 |
1.1 |
|
280 |
1.1 |
|
281 |
1.1 |
|
282 |
1.1 |
|
283 |
1.1 |
|
284 |
1.1 |
|
285 |
1.1 |
|
286 |
1.1 |
|
287 |
1.1 |
|
290 |
1.1 |
|
293 |
1.1 2.2 |
|
294 |
1.1 2.2 |
|
295 |
1.1 |
|
298 |
1.1 |
|
307 |
1.1 2.2 |
|
308 |
1.1 |
|
310 |
1.1 |
|
311 |
1.1 2.2 |
|
313 |
1.1 2.2 3.3 |
|
314 |
1.1 2.2 |
|
315 |
1.1 |
|
316 |
1.1 |
|
317 |
1.1 |
|
320 |
1.1 |
|
321 |
1.1 |
|
329 |
1.1 2.2 |
|
331 |
1.1 2.2 3.3 |
|
333 |
1.1 |
|
341 |
1.1 |
|
353 |
1.1 |
|
354 |
1.1 |
|
361 |
1.1 |
|
369 |
1.1 |
|
370 |
1.1 |
|
377 |
1.1 |
|
386 |
1.1 |
|
388 |
1.1 |
|
392 |
1.1 |
|
393 |
1.1 |
|
397 |
1.1 |
|
399 |
1.1 |
|
400 |
1.1 |
|
402 |
1.1 |
|
403 |
1.1 |
|
404 |
1.1 |
|
405 |
1.1 |
|
406 |
1.1 |
|
408 |
1.1 |
|
409 |
1.1 2.2 |
|
416 |
1.1 2.2 |
|
420 |
1.1 2.2 |
|
423 |
1.1 |
|
429 |
1.1 2.2 |
|
432 |
1.1 |
|
433 |
1.1 |
|
441 |
1.1 |
|
442 |
1.1 |
|
443 |
1.1 |
|
444 |
1.1 |
|
445 |
1.1 2.2 |
|
446 |
1.1 |
|
447 |
1.1 |
|
448 |
1.1 |
|
449 |
1.1 |
|
451 |
1.1 |
|
452 |
1.1 |
|
453 |
1.1 |
|
456 |
1.1 |
|
457 |
1.1 |
|
458 |
1.1 |
|
460 |
1.1 |
|
461 |
1.1 |
|
463 |
1.1 |
|
465 |
1.1 |
|
466 |
1.1 2.2 |
|
467 |
1.1 |
|
468 |
1.1 |
|
469 |
1.1 |
|
472 |
1.1 |
|
473 |
1.1 |
|
482 |
1.1 |
|
483 |
1.1 2.2 |
|
485 |
1.1 |
|
487 |
1.1 |
|
488 |
1.1 |
|
496 |
1.1 |
|
498 |
1.1 |
|
499 |
1.1 |
|
501 |
1.1 |
|
503 |
1.1 |
|
504 |
1.1 |
|
506 |
1.1 |
|
507 |
1.1 |
|
508 |
1.1 2.2 |
|
509 |
1.1 |
|
510 |
1.1 |
|
513 |
1.1 |
|
514 |
1.1 |
|
515 |
1.1 |
|
516 |
1.1 |
|
517 |
1.1 |
|
519 |
1.1 |
|
520 |
1.1 |
|
521 |
1.1 |
|
522 |
1.1 |
|
523 |
1.1 |
|
524 |
1.1 |
|
527 |
1.1 |
|
528 |
1.1 |
|
529 |
1.1 |
|
531 |
1.1 |
|
532 |
1.1 |
|
534 |
1.1 |
|
536 |
1.1 |
|
537 |
1.1 |
|
541 |
1.1 |
|
545 |
1.1 |
|
549 |
1.1 |
|
553 |
1.1 |
|
554 |
1.1 2.2 3.3 |
|
556 |
1.1 |
|
563 |
1.1 |
|
564 |
1.1 |
|
565 |
1.1 |
|
572 |
1.1 |
|
580 |
1.1 |
|
581 |
1.1 |
|
583 |
1.1 |
|
584 |
1.1 |
|
585 |
1.1 |
|
593 |
1.1 |
|
599 |
1.1 2.2 3.3 |
|
601 |
1.1 2.2 3.3 4.4 |
|
602 |
1.1 2.2 |
|
607 |
1.1 |
|
609 |
1.1 |
|
610 |
1.1 |
|
612 |
1.1 |