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.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.bouncycastle.crypto.BlockCipher; |
26 |
|
import org.bouncycastle.crypto.engines.RC564Engine; |
27 |
|
import org.bouncycastle.crypto.params.RC5Parameters; |
28 |
|
import org.xwiki.component.annotation.Component; |
29 |
|
import org.xwiki.crypto.params.cipher.symmetric.KeyParameter; |
30 |
|
import org.xwiki.crypto.params.cipher.symmetric.RC5KeyParameters; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
@version |
40 |
|
@since |
41 |
|
|
42 |
|
@Component |
43 |
|
@Singleton |
44 |
|
@Named("RC5-64/CBC/PKCS7Padding") |
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.8 |
|
45 |
|
public class BcRc5b128CbcPaddedCipherFactory extends AbstractBcCbcPaddedCipherFactory |
46 |
|
{ |
47 |
|
|
48 |
|
private static final int[] KEY_SIZES = newKeySizeArray(0, 256, 8); |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
50 |
0 |
@Override... |
51 |
|
protected org.bouncycastle.crypto.CipherParameters getBcKeyParameter(KeyParameter parameter) |
52 |
|
{ |
53 |
0 |
if (parameter instanceof RC5KeyParameters) { |
54 |
0 |
return new RC5Parameters(parameter.getKey(), ((RC5KeyParameters) parameter).getRounds()); |
55 |
|
} else { |
56 |
0 |
return new org.bouncycastle.crypto.params.KeyParameter(parameter.getKey()); |
57 |
|
} |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0 |
@Override... |
61 |
|
protected BlockCipher getEngineInstance() |
62 |
|
{ |
63 |
0 |
return new RC564Engine(); |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0 |
@Override... |
67 |
|
public int[] getSupportedKeySizes() |
68 |
|
{ |
69 |
0 |
return KEY_SIZES; |
70 |
|
} |
71 |
|
} |