gpt4 book ai didi

java - 获取错误 org.jasypt.exceptions.EncryptionInitializationException : Password not set for Password Based Encryptor

转载 作者:行者123 更新时间:2023-11-30 07:26:00 25 4
gpt4 key购买 nike

我正在使用 jasypt-1.9.0 进行加密。

Jdbc.properties

jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:ORCL
jdbc.username=testuser
jdbc.password=ENC(lKmVnTVL3zSJXrZpwFmhd6crSHLzYihH)
hibernate.dialect=org.hibernate.dialect.OracleDialect
jpa.databasePlatform=toplink.hibernate.EssentialsHSQLPlatformWithNative
jpa.database=ORCL
C:\jasypt-1.9.0\bin>encrypt input=testuser password=testuser----ENVIRONMENT-----------------Runtime: Sun Microsystems Inc. Java HotSpot(TM) Client VM 1.5.0_17-b04----ARGUMENTS-------------------input: testuserpassword: testuser----OUTPUT----------------------lKmVnTVL3zSJXrZpwFmhd6crSHLzYihH

I got the reference from one of your site. I am using multiple context file. I haveconfigured

<bean
class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfi
gurer">
<constructor-arg>
<bean class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config">
<bean
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" />
</bean>
</property>
</bean>
</constructor-arg>
<property name="locations">
<list>
<value>classpath:/META-INF/props/db/jdbc.properties</
value>
</list>
</property>
</bean>

<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"
value="${jdbc.driverClassName}" ></property>

<property name="url"
value="${jdbc.url}" ></property>
<property name="username"
value="${jdbc.username}" ></property>
<property name="password"
value="${jdbc.password}"></property>
<property name="initialSize" value="10"> </property>
<property name="maxActive"
value="30"> </property>
<property name="maxIdle"
value="10"> </property>
<property name="maxWait"
value="5000"> </
property>
<property name="removeAbandoned"
value="true"> </
property>
<property name="logAbandoned"
value="true"> </
property>

</bean>

当我登录我的应用程序时出现错误::

org.jasypt.exceptions.EncryptionInitializationException: Password not set for Password Based Encryptor

最佳答案

您的“APP_ENCRYPTION_PASSWORD”属性似乎没有正确设置为环境变量。参见 this链接以检查它是否已正确设置为环境变量。要检查其余配置是否有问题,请更改 <property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" /><property name="password" value="YOUR_PLAIN_TEXT_PASSWORD_HERE" />并将 YOUR_PLAIN_TEXT_PASSWORD_HERE 替换为您的纯文本密码,以测试您的其余配置是否正常工作。

要在 Windows XP 中将 APP_ENCRYPTION_PASSWORD 设置为环境变量,请参阅此 link .

或者,您可以在运行程序时将密码作为 vm 参数传递。如果它是一个独立的程序,你将像 java ClassWithMain -DAPP_ENCRYPTION_PASSWORD=your_password 一样传递它.如果它是一个 Web 应用程序,您将必须在启动服务器时传递相同的参数。参见 this关于如何为 tomcat 执行此操作的问题。然后在您的 Spring 配置中,替换 <property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" /><property name="passwordSysPropertyName" value="APP_ENCRYPTION_PASSWORD" /> .

关于java - 获取错误 org.jasypt.exceptions.EncryptionInitializationException : Password not set for Password Based Encryptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10600297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com