當試圖安裝使用Maven的模塊,它引發了以下錯誤:加密異常而載入應用程序屬性(爪哇jasypt加密)
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
的應用程序屬性進行編碼這樣的:
app.check.url=ENC(sCO3322RNYdt3wPfO04GoaN9PijwJzUcn9rb4ggHymA\=)
我的Spring配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="placeholderConfig" class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor"/>
<property name="ignoreResourceNotFound">
<value>true</value>
</property>
<property name="ignoreUnresolvablePlaceholders">
<value>false</value>
</property>
<property name="locations">
<list>
<!-- These always come from the file system in ./conf/appCtx -->
<value>file:../application.properties</value>
</list>
</property>
<property name="systemPropertiesModeName">
<value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
</property>
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration"/>
</bean>
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndTripleDES"/>
<property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD"/>
</bean>
而且我有jdk 1.7,它有加密所需的JCE文件。
關於如何解決此問題的任何想法?
你包含JCE文件? – Ami
@ILLA我沒有安裝任何額外的東西。 JCE文件已經存在於我的jdk的lib/security文件夾中。 – Chillax
ok.Inside JCE文件裏有什麼罐子?主要是安裝jce需要兩個jar包? local_policy.jar和US_export_policy.jar。 – Ami