在一个改修项目里,安全性方面总是出一个bug,错误信息如下:
xception in thread "main" javax.crypto.BadPaddingException: java.security.DigestException: Length must be at least 32 for SHA-256digests at sun.security.rsa.RSAPadding.mgf1(RSAPadding.java:469) at sun.security.rsa.RSAPadding.padOAEP(RSAPadding.java:394) at sun.security.rsa.RSAPadding.pad(RSAPadding.java:246) at sun.security.rsa.RSAPadding.pad(RSAPadding.java:228)
Length must be at least 32 for SHA-256digests。最后,大费周章,问题解决,因为java 版本的问题。java 1.7.0_03版本里存在这个bug。
官网信息链接如下:
https://bugs.java.com/bugdatabase/view_bug.do%3Fbug_id%3D8058549