gpt4 book ai didi

java - 生气...简单的代码,但是... org.jasypt.exceptions.EncryptionOperationNotPossibleException

转载 作者:行者123 更新时间:2023-12-02 08:23:55 26 4
gpt4 key购买 nike

我已经在我的网络应用程序的服务器代码中一次又一次地使用了此代码或类似的代码,但现在我正在尝试创建一个命令行实用程序来与维护后端一起使用。

继续收到EncryptionOperationNotPossibleException,但看不到我在代码中做错了什么。为了测试该代码片段,我使用了真正的加密字符串来确保它不是测试输入。

有人知道这个异常来自代码中的哪里吗?

import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
import org.jasypt.util.text.BasicTextEncryptor;

public class decipher {

/**
* @param args
*/
public static void main(String[] args) {
if (args[0] != null) {
String encstr = args[0];
String decstr = "";

if (encstr != null && !encstr.equals("")) {
try {
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
textEncryptor.setPassword("1234566789");
decstr = textEncryptor.decrypt(encstr);
System.out.println(decstr);
} catch (EncryptionOperationNotPossibleException e) {
System.out.println(e.toString());
}
} else {
System.out.println("Passed empty string... not decrypted.");
}
} else {
System.out.println("This program requires and encrypted text input.");
}
}
}

最佳答案

已修复!事实证明,我使用的输入字符串首先不是有效的加密字符串!首先使用加密运行脚本,复制并粘贴字符串,然后对该字符串运行解密...

关于java - 生气...简单的代码,但是... org.jasypt.exceptions.EncryptionOperationNotPossibleException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4905281/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com