Skip to content

Commit

Permalink
Fix compilation error on JDK 15 (netty#10462)
Browse files Browse the repository at this point in the history
Motivation:

AlgorithmId.sha256WithRSAEncryption_oid was removed in JDK15 and later so we should not depend on it as otherwise we will see compilation errors

Modifications:

Replace AlgorithmId.sha256WithRSAEncryption_oid usage with specify the OID directly

Result:

Compiles on JDK15+
  • Loading branch information
normanmaurer authored Aug 10, 2020
1 parent a4c44aa commit bb18479
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static String[] generate(String fqdn, KeyPair keypair, SecureRandom random, Date
info.set(X509CertInfo.VALIDITY, new CertificateValidity(notBefore, notAfter));
info.set(X509CertInfo.KEY, new CertificateX509Key(keypair.getPublic()));
info.set(X509CertInfo.ALGORITHM_ID,
new CertificateAlgorithmId(new AlgorithmId(AlgorithmId.sha256WithRSAEncryption_oid)));
// sha256WithRSAEncryption
new CertificateAlgorithmId(AlgorithmId.get("1.2.840.113549.1.1.11")));

// Sign the cert to identify the algorithm that's used.
X509CertImpl cert = new X509CertImpl(info);
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<testJvm />
</properties>
</profile>
<!-- JDK14 -->
<!-- JDK15 -->
<profile>
<id>java15</id>
<activation>
Expand All @@ -118,6 +118,7 @@
<skipOsgiTestsuite>true</skipOsgiTestsuite>
</properties>
</profile>
<!-- JDK14 -->
<profile>
<id>java14</id>
<activation>
Expand Down

0 comments on commit bb18479

Please sign in to comment.