tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1734791 - /tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
Date Sun, 13 Mar 2016 12:00:04 GMT
Author: fschumacher
Date: Sun Mar 13 12:00:04 2016
New Revision: 1734791

URL: http://svn.apache.org/viewvc?rev=1734791&view=rev
Log:
Use o.a.t.u.c.b.Base64 instead of java 8 Base64 encoder.

Modified:
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java?rev=1734791&r1=1734790&r2=1734791&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java Sun Mar
13 12:00:04 2016
@@ -23,7 +23,6 @@ import java.security.cert.CertificateExc
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
-import java.util.Base64;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -43,6 +42,7 @@ import org.apache.tomcat.jni.Certificate
 import org.apache.tomcat.jni.Pool;
 import org.apache.tomcat.jni.SSL;
 import org.apache.tomcat.jni.SSLContext;
+import org.apache.tomcat.util.codec.binary.Base64;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.Constants;
 import org.apache.tomcat.util.net.SSLHostConfig;
@@ -53,6 +53,8 @@ import org.apache.tomcat.util.res.String
 
 public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext {
 
+    private static final Base64 BASE64_ENCODER = new Base64(64, new byte[] {'\n'});
+
     private static final Log log = LogFactory.getLog(OpenSSLContext.class);
 
     // Note: this uses the main "net" package strings as many are common with APR
@@ -325,7 +327,7 @@ public class OpenSSLContext implements o
                 X509Certificate certificate = keyManager.getCertificateChain(alias)[0];
                 PrivateKey key = keyManager.getPrivateKey(alias);
                 StringBuilder sb = new StringBuilder(BEGIN_KEY);
-                sb.append(Base64.getMimeEncoder(64, new byte[] {'\n'}).encodeToString(key.getEncoded()));
+                sb.append(BASE64_ENCODER.encodeToString(key.getEncoded()));
                 sb.append(END_KEY);
                 SSLContext.setCertificateRaw(ctx, certificate.getEncoded(), sb.toString().getBytes(StandardCharsets.US_ASCII),
SSL.SSL_AIDX_RSA);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message