使用 Java 的 AES 加密
AES encryption using Java
我一直在使用 AES 加密来验证用户身份。但最近遇到一个问题,当用户升级他的产品并尝试使用他的凭据登录时,下面的错误消息抛给 jboss:
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) Caused by: aesdpapi.AesDataProtectionAPIException: A native error occured in function 'UnprotectData'. Error 87 : The parameter is incorrect.
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at aesdpapi.AesDataProtectionAPI.unprotectDataNative(Native Method)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at aesdpapi.AesDataProtectionAPI.unprotectData(AesDataProtectionAPI.java:348)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.decryptLdapPasswordUsingAES(LDAPAuthenticationModel.java:348)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.getRSAPasswordFromAES(LDAPAuthenticationModel.java:326)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.decryptLdapPassword(LDAPAuthenticationModel.java:312)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.loadLDAPAttributes(LDAPAuthenticationModel.java:229)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.<init>(LDAPAuthenticationModel.java:186)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.AuthenticationModelFactoryImpl.createInstance_aroundBody0(AuthenticationModelFactoryImpl.java:49)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.AuthenticationModelFactoryImpl$AjcClosure1.run(AuthenticationModelFactoryImpl.java:1)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.aop.monitor.MonitoredClassAspect.run(MonitoredClassAspect.java:53)
aesdpapi 是我用来存储 AES 相关文件的客户库。我需要知道为什么会出现此异常,导致此异常的可能原因是什么。
我怀疑新版本使用新密钥解密用户密码,该密码在升级产品之前是用旧密钥加密的。升级后生成新密钥,无法解密旧密钥加密的密码
这是由于 Java 密钥库文件和证书文件不匹配造成的。
我一直在使用 AES 加密来验证用户身份。但最近遇到一个问题,当用户升级他的产品并尝试使用他的凭据登录时,下面的错误消息抛给 jboss:
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) Caused by: aesdpapi.AesDataProtectionAPIException: A native error occured in function 'UnprotectData'. Error 87 : The parameter is incorrect.
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at aesdpapi.AesDataProtectionAPI.unprotectDataNative(Native Method)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at aesdpapi.AesDataProtectionAPI.unprotectData(AesDataProtectionAPI.java:348)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.decryptLdapPasswordUsingAES(LDAPAuthenticationModel.java:348)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.getRSAPasswordFromAES(LDAPAuthenticationModel.java:326)
11:17:02,907 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.decryptLdapPassword(LDAPAuthenticationModel.java:312)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.loadLDAPAttributes(LDAPAuthenticationModel.java:229)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.LDAPAuthenticationModel.<init>(LDAPAuthenticationModel.java:186)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.AuthenticationModelFactoryImpl.createInstance_aroundBody0(AuthenticationModelFactoryImpl.java:49)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.security.bo.impl.AuthenticationModelFactoryImpl$AjcClosure1.run(AuthenticationModelFactoryImpl.java:1)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
11:17:02,923 INFO [stdout] (ajp-/0.0.0.0:9009-1) at com.gehcit.cp.aop.monitor.MonitoredClassAspect.run(MonitoredClassAspect.java:53)
aesdpapi 是我用来存储 AES 相关文件的客户库。我需要知道为什么会出现此异常,导致此异常的可能原因是什么。
我怀疑新版本使用新密钥解密用户密码,该密码在升级产品之前是用旧密钥加密的。升级后生成新密钥,无法解密旧密钥加密的密码
这是由于 Java 密钥库文件和证书文件不匹配造成的。