Java加密包--Jasypt
来源:互联网 发布:linux 网桥 编辑:程序博客网 时间:2024/06/05 18:01
今天需要读取一个properties文件,里面存取用户名和密码,但了为安全起见,采取加密的方式,在网上搜了了一下,发现有几种方式,但个人觉得简单的还是用下面的开源jar来实现。最新版本已经发布到了1.7了。
Jasypt这个Java类包为开发人员提供一种简单的方式来为项目增加加密功能,包括:密码Digest认证,文本和对象加密,集成hibernate,Spring Security(Acegi)来增强密码管理。Jasypt开发团队推出了Java加密工具Jasypt 1.4,它可与Spring Framework、Hibernate和Acegi Security集成。
与项目有关的一位开发者表示,Jasypt是一个Java库,可以使开发者不需太多操作来给Java项目添加基本加密功能,而且不需要知道加密原理。
Jasypt也即Java Simplified Encryption是Sourceforge.net上的一个开源项目。在当地时间11月23号的通告中,Jasypt 1.4的新特征包括:加密属性文件(encryptable properties files)、Spring Framework集成、加密Hibernate数据源配置、新的命令行工具、URL加密的Apache wicket集成以及升级文档。
根据Jasypt文档,该技术可用于加密任务与应用程序,例如加密密码、敏感信息和数据通信、创建完整检查数据的sums. 其他性能包括高安全性、基于标准的加密技术、可同时单向和双向加密的加密密码、文本、数字和二进制文件。Jasypt也可以与Acegi Security整合也即Spring Security。Jasypt亦拥有加密应用配置的集成功能,而且提供一个开放的API从而任何一个Java Cryptography Extension都可以使用Jasypt。
Jasypt还符合RSA标准的基于密码的加密,并提供了无配置加密工具以及新的、高可配置标准的加密工具。
jasypt开源项目主页
项目地址:http://www.jasypt.org/
- import org.jasypt.util.text.BasicTextEncryptor;
- import org.jasypt.util.text.StrongTextEncryptor;
- public class EncypterTest {
- public static void main(String[] args) {
- //加密
- BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
- textEncryptor.setPassword("password");
- String newPassword = textEncryptor.encrypt("123456");
- System.out.println(newPassword);
- // 解密
- BasicTextEncryptor textEncryptor2 = new BasicTextEncryptor();
- textEncryptor2.setPassword("password");
- String oldPassword = textEncryptor2.decrypt(newPassword);
- System.out.println(oldPassword);
- System.out.println("--------------------------");
- /**
- * Utility class for easily performing high-strength encryption of texts.
- * This class internally holds a StandardPBEStringEncryptor configured this way:
- * Algorithm: PBEWithMD5AndTripleDES.
- * Key obtention iterations: 1000.
- * The required steps to use it are:
- * Create an instance (using new).
- * Set a password (using setPassword(String)).
- * Perform the desired encrypt(String) or decrypt(String) operations.
- * To use this class, you may need to download and install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
- * This class is thread-safe.
- */
- StrongTextEncryptor ste = new StrongTextEncryptor();
- //加密
- ste.setPassword("password");
- String encyptedResult= ste.encrypt("123456");
- System.out.println("encyptedResult:"+encyptedResult);
- //解密
- String dencyptedResult = ste.decrypt(encyptedResult);
- System.out.println(dencyptedResult);
- }
- }
- //NbxTTz53iW0d1GUphknPqg==
- Java加密包--Jasypt
- Java加密包--Jasypt
- Java加密包--Jasypt
- Java加密解密 -Jasypt
- 开源Java加密工具Jasypt 1.4发布
- Java jasypt对.properties配置文件密码加密
- jasypt结合spring加密
- spring jasypt加密
- java加密——Jasypt开源工具包
- jasypt 集成spring、spring boot 加密
- java jar包加密
- Jasypt 1.2发布,增强Hibernate加密支持(转载)
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- 使用jasypt对springboot的datasource密码加密
- 使用jasypt对springboot的datasource密码加密
- SSH框架数据库连接信息和保存进数据库的某些特殊字段加密(jasypt)
- CLAPACK的dgeev_求特征值
- 单纯形和单纯复形
- javascript的this关键字
- windows下注册系统热键及系统托盘功能
- 基于jquery ajax 无刷新 文件批量上传插件 GooUploader整合struts2实现上传
- Java加密包--Jasypt
- linux环境变量设置
- 通用型51单片机lcd1602驱动
- 利用maven插件cargo远程(本地)自动部署
- 第25章 实现进程间通信(IPC)
- Linux Kernel - A Developer's Guide (如何成为一个Linux内核开发者)
- java解析xml的几种方式
- 计算机操作系统之二:中断技术
- 数据库原则