1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.crypto.signer.params; |
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
@version |
26 |
|
@since |
27 |
|
|
|
|
| 70.4% |
Uncovered Elements: 8 (27) |
Complexity: 11 |
Complexity Density: 0.73 |
|
28 |
|
public class PssParameters |
29 |
|
{ |
30 |
|
private static final String DEFAULT_DIGEST = "SHA-1"; |
31 |
|
|
32 |
|
private static final byte TRAILER_1 = (byte) 0xBC; |
33 |
|
|
34 |
|
private final String hashAlgorithm; |
35 |
|
|
36 |
|
private final String maskGenAlgorithm; |
37 |
|
|
38 |
|
private final int saltLength; |
39 |
|
|
40 |
|
private final int trailerField; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0 |
public PssParameters()... |
46 |
|
{ |
47 |
0 |
this(DEFAULT_DIGEST); |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
@param |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
0 |
public PssParameters(String hashAlgorithm)... |
56 |
|
{ |
57 |
0 |
this(hashAlgorithm, -1); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
@param |
64 |
|
@param |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
12 |
public PssParameters(String hashAlgorithm, int saltLength)... |
67 |
|
{ |
68 |
12 |
this(hashAlgorithm, hashAlgorithm, saltLength, 1); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
@param |
75 |
|
@param |
76 |
|
@param |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
0 |
public PssParameters(String hashAlgorithm, String maskGenAlgorithm, int saltLength)... |
79 |
|
{ |
80 |
0 |
this(hashAlgorithm, maskGenAlgorithm, saltLength, 1); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
@param |
88 |
|
@param |
89 |
|
@param |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
91 |
16 |
public PssParameters(String hashAlgorithm, String maskGenAlgorithm, int saltLength, int trailerField)... |
92 |
|
{ |
93 |
16 |
this.hashAlgorithm = hashAlgorithm; |
94 |
16 |
this.maskGenAlgorithm = maskGenAlgorithm; |
95 |
16 |
this.saltLength = saltLength; |
96 |
16 |
this.trailerField = trailerField; |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
@return |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
32 |
public String getHashAlgorithm()... |
103 |
|
{ |
104 |
32 |
return this.hashAlgorithm; |
105 |
|
} |
106 |
|
|
107 |
|
|
108 |
|
@return |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
32 |
public String getMaskGenAlgorithm()... |
111 |
|
{ |
112 |
32 |
return this.maskGenAlgorithm; |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
@return |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
40 |
public int getSaltLength()... |
119 |
|
{ |
120 |
40 |
return this.saltLength; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
@return |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
16 |
public int getTrailerField()... |
127 |
|
{ |
128 |
16 |
return this.trailerField; |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
@return |
133 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
134 |
16 |
public byte getTrailerByte()... |
135 |
|
{ |
136 |
16 |
if (this.trailerField == 1) { |
137 |
16 |
return TRAILER_1; |
138 |
|
} |
139 |
|
|
140 |
0 |
throw new IllegalArgumentException("Unknown trailer field."); |
141 |
|
} |
142 |
|
} |