diff options
Diffstat (limited to 'dozentenmodulserver')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java | 4 | ||||
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java index 1d232a57..4a0bb522 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java @@ -3,8 +3,8 @@ package org.openslx.bwlp.sat.mail; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.Base64; -import org.apache.commons.codec.binary.Hex; import org.openslx.bwlp.thrift.iface.UserInfo; public class Mail { @@ -39,7 +39,7 @@ public class Mail { synchronized (md) { md.update(recipient.userId.getBytes(StandardCharsets.UTF_8)); md.update(message.getBytes(StandardCharsets.UTF_8)); - return Hex.encodeHexString(md.digest()); + return Base64.getEncoder().encodeToString(md.digest()); } } diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java index 35be803a..86bb3073 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java @@ -2,8 +2,8 @@ package org.openslx.bwlp.sat.mail; import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; +import java.util.Base64; -import org.apache.commons.codec.binary.Base64; import org.apache.commons.net.smtp.SimpleSMTPHeader; public class QuotingSmtpHeader extends SimpleSMTPHeader { @@ -42,9 +42,8 @@ public class QuotingSmtpHeader extends SimpleSMTPHeader { return "\"" + input + "\""; return input; } - return "=?utf-8?B?" - + new String(Base64.encodeBase64(input.getBytes(StandardCharsets.UTF_8), false), - StandardCharsets.UTF_8) + "?="; + return "=?utf-8?B?" + Base64.getEncoder().encodeToString(input.getBytes(StandardCharsets.UTF_8)) + + "?="; } private static String buildNamedAddress(String address, String name) { |