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 javax.inject.Singleton; |
23 |
|
|
24 |
|
import org.bouncycastle.crypto.BlockCipher; |
25 |
|
import org.bouncycastle.crypto.engines.DESedeEngine; |
26 |
|
import org.bouncycastle.crypto.params.DESedeParameters; |
27 |
|
import org.xwiki.component.annotation.Component; |
28 |
|
import org.xwiki.crypto.params.cipher.symmetric.KeyParameter; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@version |
34 |
|
@since |
35 |
|
|
36 |
|
@Component(hints = { "DESede/CBC/PKCS5Padding", "DESede/CBC/PKCS7Padding", "1.2.840.113549.3.7" }) |
37 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 3 |
Complexity Density: 1 |
|
38 |
|
public class BcDesEdeCbcPaddedCipherFactory extends AbstractBcCbcPaddedCipherFactory |
39 |
|
{ |
40 |
|
|
41 |
|
private static final int[] KEY_SIZES = newKeySizeArray(16, 24, 8); |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
4 |
@Override... |
44 |
|
protected org.bouncycastle.crypto.CipherParameters getBcKeyParameter(KeyParameter parameter) |
45 |
|
{ |
46 |
4 |
return new DESedeParameters(parameter.getKey()); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
6 |
@Override... |
50 |
|
protected BlockCipher getEngineInstance() |
51 |
|
{ |
52 |
6 |
return new DESedeEngine(); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
4 |
@Override... |
56 |
|
public int[] getSupportedKeySizes() |
57 |
|
{ |
58 |
4 |
return KEY_SIZES; |
59 |
|
} |
60 |
|
} |