SSH Framework database connection information and some special fields saved into the database encryption (JASYPT) __ Database

Source: Internet
Author: User
Tags ssh

The database connection information is described in the following steps:

1. Configure the properties file.

2. Configure the spring configuration file.

The code for Step 1 is as follows:

Pts4.jdbc.driverclassname=com.mysql.jdbc.driver pts4.jdbc.url=jdbc:mysql://localhost:3306/acmeeting Pts4.jdbc.username=enc (t3b1ivb7jirlgf9lkrmsqa==) Pts4.jdbc.password=enc (2g69lhqhtq8fzrz8f5dmew==)

The code for Step 2 is as follows:

<bean id= "Environmentvariablesconfiguration" class= " Org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig "> <property name=" algorithm "value=" Pbewithmd5anddes "/> <property name=" password "value=" Jasypt "/> </bean> <!--Specify encrypted class--<bean ID = "Configurationencryptor" class= "Org.jasypt.encryption.pbe.StandardPBEStringEncryptor" > <property name= " Config "ref=" environmentvariablesconfiguration "/> </bean> <!--read Properties file--<bean id=" Propertyconfigurer "class=" Org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer "> < Constructor-arg ref= "Configurationencryptor"/> <property name= "Locations" > <list> <value> classpath:db.properties</value> </list> </property> </bean>

Encryption of database special fields as long as the mapping configuration file settings for hibernate, the code is as follows:

Configure a typedef and then set the Type property on the special field that you want to encrypt.

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.