嗨¡ 我在使用加密字符串来获取用户的 pdf 时遇到问题。它显示以下错误:
javax.crypto.IllegalBlockSizeException:使用填充密码解密时,输入长度必须是 8 的倍数
代码在那里:
public void getPDF(WebRequest request, ResourceResponse response, Model model,
@RequestParam("cif") String cif,
@RequestParam("cuenta") String cuenta,
@RequestParam("objectId") String encryptedObjectId) throws Exception{
log.info("Inicio metodo getPDF");
OutputStream os = response.getPortletOutputStream();
try {
CipherHelper cipher = new CipherHelper(CipherHelper.TRIPLE_DES_ALGORITHM, InterfazConstantes.ENCRYPTION_KEY, InterfazConstantes.ENCRYPTION_SHIFT);
String objectId = cipher.decrypt(encryptedObjectId, true);
public String getEncryptedObjectID() {
try {
CipherHelper cipher = new CipherHelper(CipherHelper.TRIPLE_DES_ALGORITHM, InterfazConstantes.ENCRYPTION_KEY, InterfazConstantes.ENCRYPTION_SHIFT);
encryptedObjectID = cipher.encrypt(objectID, true);
} catch (Exception e) {
}
return encryptedObjectID;
}
** 我建立了 encryptedObject id 的长度为 40,但它不能解决问题 jet。
错误的痕迹是:
javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..) ~[sunjce_provider.jar:1.6]
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..) ~[sunjce_provider.jar:1.6]
有人能帮我吗?
谢谢