捡来的笔记

使用jasypt引发JCE限制的解决办法

转载请注明出处:
http://dyhdyh.com/archives/70.html

在使用StandardPBEStringEncryptor进行加密的时候,抛出了如下异常。

Exception in thread "main" org.jasypt.exceptions.EncryptionOperationNotPossibleException: Encryption raised an exception. A possible cause is you are using strong encryption algorithms and you have not installed the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files in this Java Virtual Machine
	at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.handleInvalidKeyException(StandardPBEByteEncryptor.java:814)
	at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.encrypt(StandardPBEByteEncryptor.java:694)
	at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:552)

原因:

在网上搜索后了解到,是因为jdk加密组件的限制

 

解决办法:

1.下载官网提供的扩展包

jdk1.8扩展包下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

解压后如图

 

2.将local_policy.jarUS_export_policy.jar复制到jdk目录下的\jre\lib\security替换掉,如图

 

 

 

 

点赞

发表评论