【问题标题】:jasypt spring hibernate - what password is what?jasypt spring hibernate - 什么密码是什么?
【发布时间】:2016-04-27 20:01:52
【问题描述】:

我正在尝试使用 jasypt 来加密我们的属性文件中的一些密码。我按照 jasypt 网站上的指南进行操作,但我认为我把密码弄乱了。我希望这里有人能告诉我我做对了还是做错了。现在......当我启动我的 jboss 服务器时,当它试图访问数据库时,我得到一个“无效的用户名/密码”错误。要么解密失败,要么我的设置错误。 这是设置的方式。

我生成的加密密码如下:

c:\jasypt-1.9.2\bin\encrypt input=mydbpassword password=password   
----ENVIRONMENT----------------

Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 24.45-b08

-----ARGUMENTS-----------------
input: mydbpassword
password: password

------OUTPUT-------------------
N6Wz+z6fI24MagR5A4xNoH4gMh75Vo0

问题 #1:我假设我的数据库密码进入“输入”。如果是这样...那么密码字段是做什么用的??

我的persistence.xml:

<property name="connection.provider_class" value="org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagementConnectionProvider" />
<property name="connection.encryptor_registered_name" value="configurationHibernateEncryptor" />

我的 Spring Bean:

<bean id="hibernateStringEncryptor"
class="org.jasypt.hibernate4.encryptor.HibernatePBEStringEncryptor">
<property name="registeredName">
    <value>strongHibernateStringEncryptor</value>
</property>
<property name="algorithm">
    <value>PBEWithMD5AndTripleDES</value>
</property>
<property name="password">
    <value>password</value>
</property>
</bean>

问题 #2:我假设加密命令中的“密码”字段在这里?我无法想象我的数据库密码会放在这里,因为这违背了加密的目的。但话又说回来......文档真的没有说那个值是什么。

感谢任何可以提供帮助的人!

-布莱克

【问题讨论】:

    标签: spring hibernate encryption jasypt


    【解决方案1】:

    你也应该提供算法。

    c:\jasypt-1.9.2\bin\encrypt input=mydbpassword password=password algorithm=PBEWithMD5AndTripleDES

    参考:http://www.jasypt.org/cli.html#Listing_algorithms

    要使用PBEWithMD5AndTripleDES,您需要将JCE Unlimited Strength Jurisdiction Policy 安装到您的JDK 中。

    参数password是加密密钥,您需要将密码解密为纯文本。

    【讨论】:

    • 你好。第一个建议让我的第一个应用程序启动并运行。像魅力一样工作。但是,我在我的 jboss 服务器上部署了另外两个应用程序,但它们都没有工作 - 具有完全相同的配置。我猜解密失败,因为我从 oracle 收到“无效的用户名/密码”。我已经验证了 hibernateStringEncryptor bean 部署和我的 persistence.xml 文件是相同的(相同的数据库密码)。关于我如何能够看到 jasypt 正在解密或者它是否甚至试图解密它的任何想法?谢谢!
    • 谢谢你 - 它确实给了我其他的尝试。我没有它所说的休眠配置,但我有persistence.xml(我相信这是休眠配置的JPA版本?)。我修改了 persistence.xml 中的 connection.encryptor_registered_name 以匹配 hibernateStringEncryptor bean 中的“registeredName”。但是,我仍然得到无效的用户名/密码。它与我的应用程序不匹配。你能想到我可以设置的任何断点,这些断点可能会给我更多关于 jasypt 解密问题的信息吗?再次感谢您抽出宝贵时间!
    猜你喜欢
    • 2012-12-19
    • 1970-01-01
    • 2016-02-06
    • 1970-01-01
    • 2017-11-23
    • 2021-05-07
    • 1970-01-01
    • 2019-06-12
    • 1970-01-01
    相关资源
    最近更新 更多