From 5ce93c11421b270e538f188857175d749d6a27cc Mon Sep 17 00:00:00 2001 From: "Tschaen, Brendan" Date: Thu, 17 Oct 2019 16:16:49 -0400 Subject: [PATCH] Encrypt/Decrypt tool Change-Id: If268c58fd20980d207c2533bd4fa4721e06baa85 Issue-ID: MUSIC-528 Signed-off-by: Tschaen, Brendan --- .../src/main/java/org/onap/music/main/CipherUtil.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/music-core/src/main/java/org/onap/music/main/CipherUtil.java b/music-core/src/main/java/org/onap/music/main/CipherUtil.java index 327022d5..3278dc12 100644 --- a/music-core/src/main/java/org/onap/music/main/CipherUtil.java +++ b/music-core/src/main/java/org/onap/music/main/CipherUtil.java @@ -259,13 +259,20 @@ public class CipherUtil { } } - /*public static void main(String[] args) { + public static void main(String[] args) { - System.out.println("Encrypted password: "+encryptPKC("cassandra")); + if (args.length < 2) { + System.out.println("Usage: java -jar CipherUtil "); + return; + } + + keyString = args[0]; + String password = args[1]; + + String enc = encryptPKC(password); + System.out.println("Encrypted password: " + enc); - System.out.println("Decrypted password: "+decryptPKC("dDhqAp5/RwZbl9yRSZg15fN7Qul9eiE/JFkKemtTib0=")); - System.out.println("Decrypted password: "+decryptPKC("I/dOtD/YYzBStbtOYhKuUUyPHSW2G9ZzdSyB8bJp4vk=")); - System.out.println("Decrypted password: "+decryptPKC("g7zJqg74dLsH/fyL7I75b4eySy3pbMS2xVqkrB5lDl8=")); - }*/ + System.out.println("Decrypted password (to verify): " + decryptPKC(enc)); + } } -- 2.16.6