qq_20554061
qq_20554061
采纳率0%
2015-02-22 10:42 阅读 1.6k

java ssh关于配置文件加密的问题

package com.imcc.breakdown.util.encrypt;

import java.util.Properties;

import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.connection.DriverManagerConnectionProvider;

import com.imcc.breakdown.action.wechat.aes.AESSecurityUtil;

//配置文件AES加密
public class MyDriverManagerConnectionProvider extends DriverManagerConnectionProvider {

public MyDriverManagerConnectionProvider() {
    super();
}

@Override
public void configure(Properties props) throws HibernateException {
        String url =props.getProperty(Environment.URL);
        String user = props.getProperty(Environment.USER);   
        String password = props.getProperty(Environment.PASS);   
        props.setProperty(Environment.USER,AESSecurityUtil.decode(user, Password.password));   
        props.setProperty(Environment.PASS, AESSecurityUtil.decode(password, Password.password));   
        props.setProperty(Environment.URL, AESSecurityUtil.decode(url, Password.password)); 
        super.configure(props);   
}

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐