Use Druid to decrypt database password __ Database

Source: Internet
Author: User
Tags decrypt

When configuring Hibernate, I met the use of Druid to decrypt the database, leaving a text for the next reference.

1. Encryption and decryption is performed in the SSH framework, respectively:

Pom.xml (Data encryption)


Config.properties (Configure decryption secret key)


So how did these two secret keys come into being?

First we have to download a Druid-1.0.16.jar package (download address: Druid-1.0.16.jar)

Second, type the command JAVA-CP Druid-1.0.16.jar com.alibaba.druid.filter.config.ConfigTools Your_password

This will generate Privatekey,publickey, as well as password, the relevant screenshots are as follows


Note 1: If you are not using Druid-1.0.16.jar, you may only generate a password.

NOTE 2: If not configured well, you may be able to report a large push of strange errors, such as:Org.springframework.beans.factory.BeanCreationException:Error Creatingbean with Name ' Shirofilter ': ....


Configure Druid Decrypt Database password

<bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource" init-method= "Init" destroy-method= "Close" >
    <property name= "url" value= "jdbc:derby:memory:spring-test;create=true"/>
    <property Username "value=" sa "/> <property name=" password "value="
    okbnxyjcnp7rvimg9npbby2xd2eyesnxgk/ axgk1ylahh771r6w0jtpwf6p8301qdwrsm5mdlygsvady+9xmba== "/>
    <property name=" Filters "value=" Config "/>
    <property name=" connectionproperties "value=" Config.decrypt=true "/> </bean
>

The main additions to the Configuration Druid decryption database password are two rows of bold configuration.

1, <property name= "connectionproperties" value= "config.decrypt=true"/>
role: Configure Configfilter decryption password
2, <property name= "Filters" value= "config"/>
role: Prompt druid data source needs to decrypt the database password



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.