This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new b260b8968b Fix failure on Java 17 - spotted by unit tests
b260b8968b is described below
commit b260b8968bc2f98b1eada10a5b1bf7ba84599d9d
Author: Mark Thomas <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]