简体   繁体   English

使用 Java 的 AES 加密

[英]AES encryption using Java

I have been using AES encryption to authentic users.我一直在对真实用户使用 AES 加密。 But recently faced an issue when an user upgraded his product and when he tried to login with his credentials, below error message thrown to jboss:但是最近当用户升级他的产品并尝试使用他的凭据登录时遇到了一个问题,下面是向 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 is my custome library to store AES related files. aesdpapi是我用来存储 AES 相关文件的客户库。 I need to know why am I getting this exception, what can be the probable cause of this exception.我需要知道为什么我会收到这个异常,这个异常的可能原因是什么。

I suspect that the new version is using the new key to decrypt the user password, which was encrypted with old key before the upgrading the product.我怀疑是新版本使用新密钥解密用户密码,在升级产品之前用旧密钥加密。 After the upgrade a new key has got generated, which is unable to decrypt the password which was encrypted by old key.升级后生成了新密钥,无法解密旧密钥加密的密码。

这是由于 Java 密钥库文件和证书文件不匹配造成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM