made encryption much more general
This commit is contained in:
parent
2926b5a9f4
commit
cfabd4e7ff
|
@ -39,22 +39,6 @@ public class EncryptUtil {
|
||||||
return decryptString(data, secretKey);
|
return decryptString(data, secretKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String changeRelevantValues(JsonNode content, Function<String, String> encryptOrDecrypt) {
|
|
||||||
if (!content.isObject()) return null;
|
|
||||||
ObjectNode objContent = (ObjectNode) content;
|
|
||||||
|
|
||||||
String passwordTextValue = objContent.get("password").textValue();
|
|
||||||
objContent.put("password", encryptOrDecrypt.apply(passwordTextValue));
|
|
||||||
|
|
||||||
String userNameTextValue = objContent.get("userName").textValue();
|
|
||||||
objContent.put("userName", encryptOrDecrypt.apply(userNameTextValue));
|
|
||||||
|
|
||||||
String urlTextValue = objContent.get("url").textValue();
|
|
||||||
objContent.put("url", encryptOrDecrypt.apply(urlTextValue));
|
|
||||||
|
|
||||||
return objContent.toPrettyString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String encryptString(String plainText, SecretKey key) {
|
public static String encryptString(String plainText, SecretKey key) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue