org.jasypt.exceptions.EncryptionOperationNotPossibleException 抛出 HTTP 状态 500
org.jasypt.exceptions.EncryptionOperationNotPossibleException throwing HTTP Status 500
我正在检查字符串是否未加密然后显示消息但它抛出 HTTP Status 500 – Internal Server Error
如下:
org.jasypt.exceptions.EncryptionOperationNotPossibleException
org.jasypt.encryption.pbe.StandardPBEByteEncryptor.decrypt(StandardPBEByteEncryptor.java:1055)
org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:725)
parvaz.aero.commons.security.Encryptor.decrypt(Encryptor.java:64)
parvaz.aero.registration.staff.reset.ResetPassword.doGet(ResetPassword.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
这是我检查字符串是否加密的方法
public static boolean isStringEncrypted(String str) {
try {
decrypt(str);
return false;
}catch(Exception e) {
return true;
}
}
如果字符串未解密,我会尝试显示我的消息
if(!isTokenNull) {
String resetTokenEmail = Encryptor.decrypt(resetToken);
boolean isEmailEncrypted = Encryptor.isStringEncrypted(resetTokenEmail);
if(isEmailEncrypted) {
String form = ChangePasswordForm.displayForm(resetToken,"","");
out.println(SiteTemplate.webPage(form));
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
尽管显示 Message.getExpired()
为什么它会抛出 HTTP Status 500 – Internal Server Error
?
我发现在以下情况下会抛出此错误:
String
已经是Encrypted
- 当加密或解密时有白色space。所以
str.replaceAll(" ", "+");
和 str.replaceAll("+", " ");
解决了这个问题
我正在检查字符串是否未加密然后显示消息但它抛出 HTTP Status 500 – Internal Server Error
如下:
org.jasypt.exceptions.EncryptionOperationNotPossibleException
org.jasypt.encryption.pbe.StandardPBEByteEncryptor.decrypt(StandardPBEByteEncryptor.java:1055)
org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:725)
parvaz.aero.commons.security.Encryptor.decrypt(Encryptor.java:64)
parvaz.aero.registration.staff.reset.ResetPassword.doGet(ResetPassword.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
这是我检查字符串是否加密的方法
public static boolean isStringEncrypted(String str) {
try {
decrypt(str);
return false;
}catch(Exception e) {
return true;
}
}
如果字符串未解密,我会尝试显示我的消息
if(!isTokenNull) {
String resetTokenEmail = Encryptor.decrypt(resetToken);
boolean isEmailEncrypted = Encryptor.isStringEncrypted(resetTokenEmail);
if(isEmailEncrypted) {
String form = ChangePasswordForm.displayForm(resetToken,"","");
out.println(SiteTemplate.webPage(form));
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
}
else {
out.println(SiteTemplate.webPage(Message.getExpired()));
}
尽管显示 Message.getExpired()
为什么它会抛出 HTTP Status 500 – Internal Server Error
?
我发现在以下情况下会抛出此错误:
String
已经是Encrypted
- 当加密或解密时有白色space。所以
str.replaceAll(" ", "+");
和str.replaceAll("+", " ");
解决了这个问题