removed use of CharSet
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.charset.StandardCharsets;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.security.SignatureException;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
import org.bouncycastle.util.Arrays;
+import org.bouncycastle.util.Strings;
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.util.io.Streams;
@@ -1337,7 +1337,9 @@ private void verifySignature(
}
}
- public void testExportNonExportableSignature() throws IOException {
+ public void testExportNonExportableSignature()
+ throws IOException
+ {
String EXPORTABLESIGNATURE = "-----BEGIN PGP SIGNATURE-----\n" +
"Version: PGPainless\n" +
"\n" +
@@ -1365,8 +1367,10 @@ public void testExportNonExportableSignature() throws IOException {
isTrue(nonExportableSig.getEncoded(true).length == 0);
}
- private PGPSignatureList readSignatures(String armored) throws IOException {
- ByteArrayInputStream byteIn = new ByteArrayInputStream(armored.getBytes(StandardCharsets.UTF_8));
+ private PGPSignatureList readSignatures(String armored)
+ throws IOException
+ {
+ ByteArrayInputStream byteIn = new ByteArrayInputStream(Strings.toByteArray(armored));
ArmoredInputStream armorIn = new ArmoredInputStream(byteIn);
PGPObjectFactory objectFactory = new BcPGPObjectFactory(armorIn);
PGPSignatureList signatures = (PGPSignatureList)objectFactory.nextObject();
