GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support bc-fips in BouncyCastleSelfSignedCertGenerator (#13954) · netty/netty@d868c7b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handler/src/main
    • java/io/netty/handler/ssl/util
      • BouncyCastleSelfSignedCertGenerator.java
      • SelfSignedCertificate.java
    • resources/META-INF/native-image/io.netty/netty-handler
      • reflect-config.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handler/src/main/java/io/netty/handler/ssl/util/BouncyCastleSelfSignedCertGenerator.java‎

Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/util/BouncyCastleSelfSignedCertGenerator.java
+19-2Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.bouncycastle.cert.X509v3CertificateBuilder;
2222
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
2323
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
24-
import org.bouncycastle.jce.provider.BouncyCastleProvider;
2524
import org.bouncycastle.operator.ContentSigner;
2625
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
2726

@@ -40,7 +39,25 @@
4039
*/
4140
final class BouncyCastleSelfSignedCertGenerator {
4241

43-
private static final Provider PROVIDER = new BouncyCastleProvider();
42+
private static final Provider PROVIDER;
43+
44+
static {
45+
Class<?> providerClass;
46+
try {
47+
providerClass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
48+
} catch (ClassNotFoundException e) {
49+
try {
50+
providerClass = Class.forName("org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider");
51+
} catch (ClassNotFoundException ignore) {
52+
throw new RuntimeException("Neither BouncyCastleProvider nor BouncyCastleFipsProvider found");
53+
}
54+
}
55+
try {
56+
PROVIDER = (Provider) providerClass.newInstance();
57+
} catch (Exception e) {
58+
throw new RuntimeException("Failed to instantiate BouncyCastle provider", e);
59+
}
60+
}
4461

4562
static String[] generate(String fqdn, KeyPair keypair, SecureRandom random, Date notBefore, Date notAfter,
4663
String algorithm) throws Exception {
Collapse file

‎handler/src/main/java/io/netty/handler/ssl/util/SelfSignedCertificate.java‎

Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/util/SelfSignedCertificate.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ private static void safeClose(File keyFile, OutputStream keyOut) {
409409

410410
private static boolean isBouncyCastleAvailable() {
411411
try {
412+
// this class is in bcpkix, both fips and non-fips
412413
Class.forName("org.bouncycastle.cert.X509v3CertificateBuilder");
413414
return true;
414415
} catch (ClassNotFoundException e) {
Collapse file

‎handler/src/main/resources/META-INF/native-image/io.netty/netty-handler/reflect-config.json‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[
2+
{
3+
"name": "org.bouncycastle.jce.provider.BouncyCastleProvider",
4+
"condition": {
5+
"typeReachable": "org.bouncycastle.jcajce.provider.BouncyCastleProvider"
6+
},
7+
"methods": [
8+
{
9+
"name": "<init>",
10+
"parameterTypes": [
11+
]
12+
}
13+
]
14+
},
15+
{
16+
"name": "org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider",
17+
"condition": {
18+
"typeReachable": "org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider"
19+
},
20+
"methods": [
21+
{
22+
"name": "<init>",
23+
"parameterTypes": [
24+
]
25+
}
26+
]
27+
}
28+
]

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.