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@f6a4533

File tree

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

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

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

@@ -39,7 +38,25 @@
3938
*/
4039
final class BouncyCastleSelfSignedCertGenerator {
4140

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

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

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

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

387387
private static boolean isBouncyCastleAvailable() {
388388
try {
389+
// this class is in bcpkix, both fips and non-fips
389390
Class.forName("org.bouncycastle.cert.X509v3CertificateBuilder");
390391
return true;
391392
} catch (ClassNotFoundException e) {
Collapse file

‎testsuite/src/main/resources/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.