print public key and private key to console
@@ -6,6 +6,7 @@ import com.quorum.tessera.config.util.JaxbUtil;
import com.quorum.tessera.nacl.KeyPair;
import com.quorum.tessera.nacl.NaclFacade;
+import javax.ws.rs.core.StreamingOutput;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.file.Files;
@@ -90,6 +91,8 @@ public class KeyGeneratorImpl implements KeyGenerator {
System.out.println("or leave blank to not save to separate file:");
final String path = new Scanner(filenameStream).nextLine();
+ String privateKeyJson = this.privateKeyToJson(finalKeys);
+
if (!path.trim().isEmpty()) {
final Path resolvedPath = Paths.get(path).toAbsolutePath();
@@ -99,11 +102,15 @@ public class KeyGeneratorImpl implements KeyGenerator {
final Path publicKeyPath = parentPath.resolve(filename + ".pub");
final Path privateKeyPath = parentPath.resolve(filename + ".key");
- final String privateKeyJson = this.privateKeyToJson(finalKeys);
-
IOCallback.execute(() -> Files.write(publicKeyPath, publicKeyBase64.getBytes(UTF_8)));
IOCallback.execute(() -> Files.write(privateKeyPath, privateKeyJson.getBytes(UTF_8)));
}
+ else {
+ System.out.println("-----PUBLIC KEY-----");
+ System.out.println(publicKeyBase64);
+ System.out.println("-----PRIVATE KEY-----");
+ System.out.println(privateKeyJson);
+ }
return finalKeys;
}
