You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2019/02/11 20:10:05 UTC
[hadoop] branch trunk updated: HDDS-1075. Fix
CertificateUtil#parseRSAPublicKey charsetName. Contributed by Siddharth
Wagle.
This is an automated email from the ASF dual-hosted git repository.
xyao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new ca4e46a HDDS-1075. Fix CertificateUtil#parseRSAPublicKey charsetName. Contributed by Siddharth Wagle.
ca4e46a is described below
commit ca4e46a05eb20106d69db481d6ac1988696a9f01
Author: Xiaoyu Yao <xy...@apache.org>
AuthorDate: Mon Feb 11 12:00:36 2019 -0800
HDDS-1075. Fix CertificateUtil#parseRSAPublicKey charsetName. Contributed by Siddharth Wagle.
---
.../apache/hadoop/security/authentication/util/CertificateUtil.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
index 1ca59ae..cf17aca 100644
--- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
+++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.security.authentication.util;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.security.PublicKey;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -45,7 +46,7 @@ public class CertificateUtil {
try {
CertificateFactory fact = CertificateFactory.getInstance("X.509");
ByteArrayInputStream is = new ByteArrayInputStream(
- fullPem.getBytes("UTF8"));
+ fullPem.getBytes(StandardCharsets.UTF_8));
X509Certificate cer = (X509Certificate) fact.generateCertificate(is);
key = cer.getPublicKey();
@@ -58,8 +59,6 @@ public class CertificateUtil {
message = "CertificateException - PEM may be corrupt";
}
throw new ServletException(message, ce);
- } catch (UnsupportedEncodingException uee) {
- throw new ServletException(uee);
}
return (RSAPublicKey) key;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org