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.internal; |
21 |
|
|
22 |
|
import java.io.IOException; |
23 |
|
import java.security.SecureRandom; |
24 |
|
|
25 |
|
import org.xwiki.crypto.params.cipher.asymmetric.PublicKeyParameters; |
26 |
|
import org.xwiki.crypto.pkix.params.CertifiedPublicKey; |
27 |
|
import org.xwiki.crypto.pkix.params.PrincipalIndentifier; |
28 |
|
import org.xwiki.crypto.pkix.params.x509certificate.X509CertificateGenerationParameters; |
29 |
|
import org.xwiki.crypto.pkix.params.x509certificate.X509CertificateParameters; |
30 |
|
import org.xwiki.crypto.pkix.params.x509certificate.extension.X509Extensions; |
31 |
|
import org.xwiki.crypto.signer.Signer; |
32 |
|
import org.xwiki.crypto.signer.SignerFactory; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 4 |
Complexity Density: 0.57 |
|
40 |
|
public class BcX509v3CertificateGenerator extends AbstractBcX509CertificateGenerator |
41 |
|
{ |
42 |
|
private final X509Extensions extensions; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
|
49 |
|
@param |
50 |
|
@param |
51 |
|
@param |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
53 |
7 |
public BcX509v3CertificateGenerator(Signer signer, X509CertificateGenerationParameters parameters,... |
54 |
|
SignerFactory signerFactory, SecureRandom random) |
55 |
|
{ |
56 |
7 |
super(signer, parameters, signerFactory, random); |
57 |
7 |
this.extensions = parameters.getExtensions(); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
7 |
@Override... |
61 |
|
protected BcX509TBSCertificateBuilder getTBSCertificateBuilder() |
62 |
|
{ |
63 |
7 |
return new BcX509v3TBSCertificateBuilder(); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
66 |
7 |
@Override... |
67 |
|
protected void extendsTBSCertificate(BcX509TBSCertificateBuilder builder, CertifiedPublicKey issuer, |
68 |
|
PrincipalIndentifier subjectName, PublicKeyParameters subject, X509CertificateParameters parameters) |
69 |
|
throws IOException |
70 |
|
{ |
71 |
7 |
BcX509v3TBSCertificateBuilder bld = (BcX509v3TBSCertificateBuilder) builder; |
72 |
|
|
73 |
7 |
if (issuer != null) { |
74 |
3 |
bld.setExtensions(issuer, subject, this.extensions, parameters.getExtensions()); |
75 |
|
} else { |
76 |
|
|
77 |
4 |
bld.setExtensions(subject, this.extensions, parameters.getExtensions()); |
78 |
|
} |
79 |
|
} |
80 |
|
} |