diff --git a/src/dorkbox/util/crypto/Crypto.java b/src/dorkbox/util/crypto/Crypto.java index ac3c3d1..67aac23 100644 --- a/src/dorkbox/util/crypto/Crypto.java +++ b/src/dorkbox/util/crypto/Crypto.java @@ -21,6 +21,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.security.Provider; import java.security.Security; import java.util.Arrays; @@ -41,8 +42,6 @@ import org.lwjgl.util.xxhash.XXH32State; import org.lwjgl.util.xxhash.XXHash; import org.slf4j.Logger; -import dorkbox.os.OS; - /** * http://en.wikipedia.org/wiki/NSA_Suite_B http://www.nsa.gov/ia/programs/suiteb_cryptography/ *

@@ -346,7 +345,7 @@ class Crypto { if (okToHash) { // System.err.println("HASHING: " + name); // hash the file name - byte[] bytes = name.getBytes(OS.US_ASCII); + byte[] bytes = name.getBytes(StandardCharsets.US_ASCII); digest.update(bytes, 0, bytes.length); if (hasAction) { diff --git a/src/dorkbox/util/crypto/CryptoPGP.java b/src/dorkbox/util/crypto/CryptoPGP.java index 9265ae9..e0a00c7 100644 --- a/src/dorkbox/util/crypto/CryptoPGP.java +++ b/src/dorkbox/util/crypto/CryptoPGP.java @@ -24,6 +24,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; import java.security.NoSuchProviderException; import java.security.SecureRandom; import java.util.ArrayList; @@ -63,7 +64,6 @@ import org.bouncycastle.openpgp.operator.bc.BcPGPDataEncryptorBuilder; import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider; import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator; -import dorkbox.os.OS; import dorkbox.util.IO; /** @@ -601,7 +601,7 @@ class CryptoPGP { // Encode the string into bytes using utf-8 - byte[] utf8Bytes = message.getBytes(OS.UTF_8); + byte[] utf8Bytes = message.getBytes(StandardCharsets.UTF_8); ByteArrayOutputStream compressedOutput = new ByteArrayOutputStream(); @@ -797,7 +797,7 @@ class CryptoPGP { void main(String[] args) throws Exception { InputStream privateKeyInputStream = new FileInputStream(new File("/home/user/dorkbox/sonatype_private.key")); - byte[] textBytes = "hello".getBytes(OS.UTF_8); + byte[] textBytes = "hello".getBytes(StandardCharsets.UTF_8); byte[] bytes = CryptoPGP.signGpgCompatible(privateKeyInputStream, "Dorkbox ", new char[0], textBytes);