| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package org.xwiki.crypto.pkix; |
| 22 |
|
|
| 23 |
|
import java.math.BigInteger; |
| 24 |
|
import java.util.Collection; |
| 25 |
|
|
| 26 |
|
import org.xwiki.crypto.pkix.params.CertifiedPublicKey; |
| 27 |
|
import org.xwiki.crypto.pkix.params.PrincipalIndentifier; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@version |
| 33 |
|
@since |
| 34 |
|
|
| |
|
| 52.6% |
Uncovered Elements: 18 (38) |
Complexity: 9 |
Complexity Density: 0.36 |
|
| 35 |
|
public class ChainingCertificateProvider implements CertificateProvider |
| 36 |
|
{ |
| 37 |
|
private final CertificateProvider[] providers; |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
@param |
| 43 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 44 |
7 |
public ChainingCertificateProvider(CertificateProvider... providers)... |
| 45 |
|
{ |
| 46 |
7 |
this.providers = providers; |
| 47 |
|
} |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 49 |
12 |
@Override... |
| 50 |
|
public CertifiedPublicKey getCertificate(byte[] keyIdentifier) |
| 51 |
|
{ |
| 52 |
12 |
CertifiedPublicKey result = null; |
| 53 |
12 |
for (CertificateProvider provider : this.providers) { |
| 54 |
24 |
result = provider.getCertificate(keyIdentifier); |
| 55 |
24 |
if (result != null) { |
| 56 |
12 |
break; |
| 57 |
|
} |
| 58 |
|
} |
| 59 |
12 |
return result; |
| 60 |
|
} |
| 61 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 62 |
6 |
@Override... |
| 63 |
|
public CertifiedPublicKey getCertificate(PrincipalIndentifier issuer, BigInteger serial) |
| 64 |
|
{ |
| 65 |
6 |
CertifiedPublicKey result = null; |
| 66 |
6 |
for (CertificateProvider provider : this.providers) { |
| 67 |
11 |
result = provider.getCertificate(issuer, serial); |
| 68 |
11 |
if (result != null) { |
| 69 |
6 |
break; |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
6 |
return result; |
| 73 |
|
} |
| 74 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 75 |
0 |
@Override... |
| 76 |
|
public CertifiedPublicKey getCertificate(PrincipalIndentifier issuer, BigInteger serial, byte[] keyIdentifier) |
| 77 |
|
{ |
| 78 |
0 |
CertifiedPublicKey result = null; |
| 79 |
0 |
for (CertificateProvider provider : this.providers) { |
| 80 |
0 |
result = provider.getCertificate(issuer, serial, keyIdentifier); |
| 81 |
0 |
if (result != null) { |
| 82 |
0 |
break; |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
0 |
return result; |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 88 |
0 |
@Override... |
| 89 |
|
public Collection<CertifiedPublicKey> getCertificate(PrincipalIndentifier subject) |
| 90 |
|
{ |
| 91 |
0 |
Collection<CertifiedPublicKey> result = null; |
| 92 |
0 |
for (CertificateProvider provider : this.providers) { |
| 93 |
0 |
result = provider.getCertificate(subject); |
| 94 |
0 |
if (result != null) { |
| 95 |
0 |
break; |
| 96 |
|
} |
| 97 |
|
} |
| 98 |
0 |
return result; |
| 99 |
|
} |
| 100 |
|
} |