From dd5d790e211639c063a5019324f21e31d0769d54 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sun, 6 Nov 2022 20:22:40 +0100 Subject: [PATCH] Properly format session keys for --session-key-out --- .../src/main/java/sop/cli/picocli/commands/DecryptCmd.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java index 08c8d22..e6ac82a 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -137,7 +138,8 @@ public class DecryptCmd extends AbstractSopCmd { } else { SessionKey sessionKey = result.getSessionKey().get(); outputStream.write(sessionKey.getAlgorithm()); - outputStream.write(sessionKey.getKey()); + // noinspection CharsetObjectCanBeUsed + outputStream.write(sessionKey.toString().getBytes(Charset.forName("UTF8"))); } } }