1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.crypto.cipher.internal.symmetric.factory; |
21 |
|
|
22 |
|
import org.junit.Before; |
23 |
|
import org.junit.Rule; |
24 |
|
import org.xwiki.crypto.cipher.Cipher; |
25 |
|
import org.xwiki.crypto.cipher.CipherFactory; |
26 |
|
import org.xwiki.crypto.params.cipher.symmetric.KeyWithIVParameters; |
27 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
28 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.38 |
|
29 |
|
public class BcCast5CbcPaddedCipherFactoryTest extends AbstractSymmetricCipherFactoryTest |
30 |
|
{ |
31 |
|
@Rule |
32 |
|
public final MockitoComponentMockingRule<CipherFactory> mocker = |
33 |
|
new MockitoComponentMockingRule<CipherFactory>(BcCast5CbcPaddedCipherFactory.class); |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
35 |
12 |
{... |
36 |
12 |
CIPHER_ALGO = "CAST5/CBC/PKCS5Padding"; |
37 |
12 |
BLOCK_SIZE = 8; |
38 |
12 |
KEY_SIZE = 16; |
39 |
12 |
SUPPORTED_KEY_SIZE = new int[] { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; |
40 |
|
|
41 |
12 |
BYTES_ENCRYPTED_SIZE = ((BYTES.length / BLOCK_SIZE) * BLOCK_SIZE) + BLOCK_SIZE; |
42 |
12 |
ANOTHER_BYTES_ENCRYPTED_SIZE = ((ANOTHER_BYTES.length / BLOCK_SIZE) * BLOCK_SIZE) + BLOCK_SIZE; |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
12 |
@Before... |
46 |
|
public void configure() throws Exception |
47 |
|
{ |
48 |
12 |
factory = mocker.getComponentUnderTest(); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
51 |
2 |
@Override... |
52 |
|
Cipher getCipherInstance(boolean forEncryption) |
53 |
|
{ |
54 |
2 |
return factory.getInstance(forEncryption, new KeyWithIVParameters(KEY16, IV8)); |
55 |
|
} |
56 |
|
} |