1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.crypto.store.wiki.internal.query; |
21 |
|
|
22 |
|
import org.xwiki.crypto.BinaryStringEncoder; |
23 |
|
import org.xwiki.crypto.pkix.CertificateFactory; |
24 |
|
import org.xwiki.crypto.pkix.params.CertifiedPublicKey; |
25 |
|
import org.xwiki.crypto.store.CertificateStoreException; |
26 |
|
import org.xwiki.crypto.store.wiki.internal.X509CertificateWikiStore; |
27 |
|
import org.xwiki.model.reference.EntityReference; |
28 |
|
import org.xwiki.model.reference.EntityReferenceSerializer; |
29 |
|
import org.xwiki.query.QueryManager; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
37 |
|
public class X509CertificateKeyIdentifierQuery extends AbstractX509KeyIdentifierQuery |
38 |
|
{ |
39 |
|
private static final String SELECT_STATEMENT = |
40 |
|
"select obj." + X509CertificateWikiStore.CERTIFICATECLASS_PROP_CERTIFICATE; |
41 |
|
|
42 |
|
private static final String FROM_STATEMENT = ", doc.object(" |
43 |
|
+ X509CertificateWikiStore.CERTIFICATECLASS_FULLNAME + ") obj"; |
44 |
|
|
45 |
|
private final CertificateFactory factory; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
@param |
52 |
|
@param |
53 |
|
@param |
54 |
|
@param |
55 |
|
@throws |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
57 |
6 |
public X509CertificateKeyIdentifierQuery(EntityReference store, CertificateFactory factory,... |
58 |
|
BinaryStringEncoder encoder, QueryManager queryManager, EntityReferenceSerializer<String> serializer) |
59 |
|
throws CertificateStoreException |
60 |
|
{ |
61 |
6 |
super(store, SELECT_STATEMENT, FROM_STATEMENT, "", encoder, queryManager, serializer); |
62 |
6 |
this.factory = factory; |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
@return |
70 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
71 |
2 |
public CertifiedPublicKey getCertificate(byte[] keyIdentifier)... |
72 |
|
{ |
73 |
2 |
try { |
74 |
2 |
return this.factory.decode(getEncoder().decode(this.<String>execute(keyIdentifier).get(0))); |
75 |
|
} catch (Exception e) { |
76 |
0 |
return null; |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
} |