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