Cleanup logging

This commit is contained in:
Davide Depau 2020-11-30 22:14:07 +01:00
parent d04f7650bf
commit f53d947a13

View file

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.logging.Logger;
public class StreamAesUtils {
private static final Logger logger = Logger.getLogger(StreamAesUtils.class.getName());
public static Aes generateFromExchangeKeyAndSuperSecretKey(String keyExchange, String superSecretKey) throws NoSuchAlgorithmException {
HashMap<String, String> hashMap = new HashMap<>();
@ -20,21 +19,21 @@ public class StreamAesUtils {
if (!hashMap.containsKey("nonce")) {
return null;
}
logger.info("cipher=" + (hashMap.get("cipher")));
logger.info("username=" + (hashMap.get("username")));
logger.info("padding=" + (hashMap.get("padding")));
logger.info("algorithm=" + (hashMap.get("algorithm")));
logger.info("nonce=" + (hashMap.get("nonce")));
System.out.println("cipher=" + (hashMap.get("cipher")));
System.out.println("username=" + (hashMap.get("username")));
System.out.println("padding=" + (hashMap.get("padding")));
System.out.println("algorithm=" + (hashMap.get("algorithm")));
System.out.println("nonce=" + (hashMap.get("nonce")));
return fromUserNonceSuperSecretKey(hashMap.get("username"), hashMap.get("nonce"), superSecretKey);
}
public static Aes fromUserNonceSuperSecretKey(String username, String nonce, String superSecretKey) throws NoSuchAlgorithmException {
if (GenKey.generateDefaultUsername().equals(username)) {
logger.info("AES use User Password");
System.out.println("AES use User Password");
} else if ("none".equals(username)) {
superSecretKey = GenKey.generateDefaultPsw();
} else {
logger.info("AES key-exchange unknown username");
System.out.println("AES key-exchange unknown username");
return null;
}
byte[] md5 = md5Digest(nonce + ":" + superSecretKey);