Use UTF8Util.UTF8 constant

This commit is contained in:
Paul Schaub 2023-04-27 13:17:58 +02:00
parent 8eba099146
commit 8aded17f10
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
4 changed files with 12 additions and 12 deletions

View file

@ -4,7 +4,7 @@
package sop; package sop;
import java.nio.charset.Charset; import sop.util.UTF8Util;
/** /**
* Tuple class bundling a profile name and description. * Tuple class bundling a profile name and description.
@ -77,6 +77,6 @@ public class Profile {
*/ */
private static boolean exceeds1000CharLineLimit(Profile profile) { private static boolean exceeds1000CharLineLimit(Profile profile) {
String line = profile.toString(); String line = profile.toString();
return line.getBytes(Charset.forName("UTF8")).length > 1000; return line.getBytes(UTF8Util.UTF8).length > 1000;
} }
} }

View file

@ -5,11 +5,11 @@
package sop.operation; package sop.operation;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
import sop.util.UTF8Util;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset;
public interface AbstractSign<T> { public interface AbstractSign<T> {
@ -67,7 +67,7 @@ public interface AbstractSign<T> {
default T withKeyPassword(String password) default T withKeyPassword(String password)
throws SOPGPException.UnsupportedOption, throws SOPGPException.UnsupportedOption,
SOPGPException.PasswordNotHumanReadable { SOPGPException.PasswordNotHumanReadable {
return withKeyPassword(password.getBytes(Charset.forName("UTF8"))); return withKeyPassword(password.getBytes(UTF8Util.UTF8));
} }
/** /**

View file

@ -8,11 +8,11 @@ import sop.DecryptionResult;
import sop.ReadyWithResult; import sop.ReadyWithResult;
import sop.SessionKey; import sop.SessionKey;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
import sop.util.UTF8Util;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Date; import java.util.Date;
public interface Decrypt { public interface Decrypt {
@ -138,7 +138,7 @@ public interface Decrypt {
default Decrypt withKeyPassword(String password) default Decrypt withKeyPassword(String password)
throws SOPGPException.UnsupportedOption, throws SOPGPException.UnsupportedOption,
SOPGPException.PasswordNotHumanReadable { SOPGPException.PasswordNotHumanReadable {
return withKeyPassword(password.getBytes(Charset.forName("UTF8"))); return withKeyPassword(password.getBytes(UTF8Util.UTF8));
} }
/** /**

View file

@ -4,15 +4,15 @@
package sop.operation; package sop.operation;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import sop.Profile; import sop.Profile;
import sop.Ready; import sop.Ready;
import sop.enums.EncryptAs; import sop.enums.EncryptAs;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
import sop.util.UTF8Util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
public interface Encrypt { public interface Encrypt {
@ -82,7 +82,7 @@ public interface Encrypt {
default Encrypt withKeyPassword(String password) default Encrypt withKeyPassword(String password)
throws SOPGPException.PasswordNotHumanReadable, throws SOPGPException.PasswordNotHumanReadable,
SOPGPException.UnsupportedOption { SOPGPException.UnsupportedOption {
return withKeyPassword(password.getBytes(Charset.forName("UTF8"))); return withKeyPassword(password.getBytes(UTF8Util.UTF8));
} }
/** /**