1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.crypto.pkix.params.x509certificate.extension; |
21 |
|
|
22 |
|
import javax.mail.internet.AddressException; |
23 |
|
import javax.mail.internet.InternetAddress; |
24 |
|
|
25 |
|
import org.bouncycastle.asn1.DERIA5String; |
26 |
|
import org.bouncycastle.asn1.x509.GeneralName; |
27 |
|
import org.xwiki.crypto.pkix.internal.extension.BcGeneralName; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 87.5% |
Uncovered Elements: 3 (24) |
Complexity: 8 |
Complexity Density: 0.5 |
|
35 |
|
public class X509Rfc822Name implements X509StringGeneralName, BcGeneralName |
36 |
|
{ |
37 |
|
private final String str; |
38 |
|
|
39 |
|
private final InternetAddress addr; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@param |
45 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
46 |
4 |
public X509Rfc822Name(String address)... |
47 |
|
{ |
48 |
4 |
String newStr = null; |
49 |
4 |
InternetAddress newAddr = null; |
50 |
|
|
51 |
4 |
try { |
52 |
4 |
newAddr = new InternetAddress(address); |
53 |
4 |
newStr = newAddr.getAddress(); |
54 |
|
} catch (AddressException e) { |
55 |
0 |
newStr = address; |
56 |
|
} |
57 |
|
|
58 |
4 |
this.str = newStr; |
59 |
4 |
this.addr = newAddr; |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@param |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
67 |
1 |
public X509Rfc822Name(InternetAddress address)... |
68 |
|
{ |
69 |
1 |
this.addr = address; |
70 |
1 |
this.str = address.getAddress(); |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
@param |
77 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
78 |
2 |
public X509Rfc822Name(GeneralName name)... |
79 |
|
{ |
80 |
2 |
this(DERIA5String.getInstance(name.getName()).getString()); |
81 |
|
|
82 |
2 |
if (name.getTagNo() != GeneralName.rfc822Name) { |
83 |
0 |
throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo()); |
84 |
|
} |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
@return |
89 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
2 |
public InternetAddress getAddress()... |
91 |
|
{ |
92 |
2 |
return this.addr; |
93 |
|
} |
94 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
2 |
@Override... |
96 |
|
public String getName() |
97 |
|
{ |
98 |
2 |
return this.str; |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
3 |
@Override... |
102 |
|
public GeneralName getGeneralName() |
103 |
|
{ |
104 |
3 |
return new GeneralName(GeneralName.rfc822Name, this.str); |
105 |
|
} |
106 |
|
} |