You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/05/10 18:58:59 UTC
[tomcat] branch 9.0.x updated: Fix failure on Java 17 - spotted by unit tests
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 2bd94154ff Fix failure on Java 17 - spotted by unit tests
2bd94154ff is described below
commit 2bd94154ffa742672b1f470f41534b0fe8bae94c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 10 19:58:27 2022 +0100
Fix failure on Java 17 - spotted by unit tests
---
java/org/apache/tomcat/util/net/jsse/PEMFile.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index ab02cc8f7d..80c585d3b8 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -66,6 +66,7 @@ public class PEMFile {
new byte[] { 0x06, 0x07, 0x2A, (byte) 0x86, 0x48, (byte) 0xCE, 0x3D, 0x02, 0x01 };
private static final String OID_PKCS5_PBES2 = "1.2.840.113549.1.5.13";
+ private static final String PBES2 = "PBES2";
public static String toPEM(X509Certificate certificate) throws CertificateEncodingException {
StringBuilder result = new StringBuilder();
@@ -277,7 +278,10 @@ public class PEMFile {
private String getPBEAlgorithm(EncryptedPrivateKeyInfo privateKeyInfo) {
AlgorithmParameters parameters = privateKeyInfo.getAlgParameters();
- if (parameters != null && OID_PKCS5_PBES2.equals(privateKeyInfo.getAlgName())) {
+ String algName = privateKeyInfo.getAlgName();
+ // Java 11 returns OID_PKCS5_PBES2
+ // Java 17 returns PBES2
+ if (parameters != null && (OID_PKCS5_PBES2.equals(algName) || PBES2.equals(algName))) {
/*
* This should be "PBEWith<prf>And<encryption>".
* Relying on the toString() implementation is potentially
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org