- 浏览: 22326 次
- 性别:
- 来自: 杭州
最新评论
[size=medium]Integrating Jasypt with Hibernate
Introduction to Jasypt (Java Simplified Encryption)Jasypt is a java library which allows the developer to add basic encryption capabilities to the projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
• High-security, standards-based encryption techniques, both for unidirectional and bidirectional encryption.
• Transparent integration with Hibernate.
• Suitable for integration into Spring-based applications and also transparently integrable with Spring Security.
• Integrated capabilities for encrypting the configuration of applications (i.e. data sources).
• Specific features for high-performance encryption in multi-processor/multi-core systems.
• Open API for use with any JCE provider, thread-safe, lightweight library, easy to use CLI (Command Line Interface) tools, Integrates into Apache Wicket, Complete support for languages like Japanese, Korean, Arabic... with no encoding or platform issues.
• Etc
A Basic program for encrypting and checking a password would be like below:
1. Integration with Hibernate:Jasypt provides the jasypt-hibernate3 and jasypt-hibernate4 artifacts for Hibernate integration.
These integration libraries include several Hibernate UserType implementations that allow one or several of the properties in a mapped Hibernate entity to be declared as being of an encrypted type. Types allowed to be stored as encrypted include strings, binaries (byte arrays), numeric types, booleans and dates. Following actions are required for setting jasypt to encrypt data with hibernate
i. Configuring the Hibernate mapping (2 types - by extension or by using a registered encryptor).a. By extension, declaring the encryptor parameters in the mapping itself (password, algorithm, providerName, etc). When this method is selected, the encryptor implementation used is always a StandardPBEStringEncryptor.
b. By using a registered encryptor, which will be registered with a specific name. The name should be used in the mapping file (encryptorRegisteredName).
ii. Providing the encryptor to Hibernate (using Spring or Not Spring).Encryptor has to be created and object HibernatePBEEncryptor to wrap it and set a registered name.
1. Encrypting the db password in hibernate.cfg.xmlFor those applications that define data sources in Hibernate's hibernate.cfg.xml file, Jasypt provides two Connection Provider (org.hibernate.connection.ConnectionProvider) implementations which let the user declare the datasource parameters (driver, url, username and password) in an encrypted manner:
•org.jasypt.hibernate3|hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider, which extends Hibernate's Driver Manager connection provider (a very simplistic pool implementation).
•org.jasypt.hibernate3|hibernate4.connectionprovider.EncryptedPasswordC3P0ConnectionProvider, which extends Hibernate's C3P0-based connection provider.
Hibernate will use Jasypt's DriverManager-based connection provider and is passed a set of configuration parameters which contain an encrypted value, the connection.password property. The encryptor object should be mentioned for decrypting the encrypted parameters (connection.encryptor_registered_name).
References[/size]• http://mvnrepository.com/artifact/org.jasypt
• http://camel.apache.org/jasypt.html
• http://www.jasypt.org/[/size][/size][/size][/size]
Introduction to Jasypt (Java Simplified Encryption)Jasypt is a java library which allows the developer to add basic encryption capabilities to the projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
• High-security, standards-based encryption techniques, both for unidirectional and bidirectional encryption.
• Transparent integration with Hibernate.
• Suitable for integration into Spring-based applications and also transparently integrable with Spring Security.
• Integrated capabilities for encrypting the configuration of applications (i.e. data sources).
• Specific features for high-performance encryption in multi-processor/multi-core systems.
• Open API for use with any JCE provider, thread-safe, lightweight library, easy to use CLI (Command Line Interface) tools, Integrates into Apache Wicket, Complete support for languages like Japanese, Korean, Arabic... with no encoding or platform issues.
• Etc
A Basic program for encrypting and checking a password would be like below:
1. Integration with Hibernate:Jasypt provides the jasypt-hibernate3 and jasypt-hibernate4 artifacts for Hibernate integration.
These integration libraries include several Hibernate UserType implementations that allow one or several of the properties in a mapped Hibernate entity to be declared as being of an encrypted type. Types allowed to be stored as encrypted include strings, binaries (byte arrays), numeric types, booleans and dates. Following actions are required for setting jasypt to encrypt data with hibernate
i. Configuring the Hibernate mapping (2 types - by extension or by using a registered encryptor).a. By extension, declaring the encryptor parameters in the mapping itself (password, algorithm, providerName, etc). When this method is selected, the encryptor implementation used is always a StandardPBEStringEncryptor.
b. By using a registered encryptor, which will be registered with a specific name. The name should be used in the mapping file (encryptorRegisteredName).
ii. Providing the encryptor to Hibernate (using Spring or Not Spring).Encryptor has to be created and object HibernatePBEEncryptor to wrap it and set a registered name.
1. Encrypting the db password in hibernate.cfg.xmlFor those applications that define data sources in Hibernate's hibernate.cfg.xml file, Jasypt provides two Connection Provider (org.hibernate.connection.ConnectionProvider) implementations which let the user declare the datasource parameters (driver, url, username and password) in an encrypted manner:
•org.jasypt.hibernate3|hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider, which extends Hibernate's Driver Manager connection provider (a very simplistic pool implementation).
•org.jasypt.hibernate3|hibernate4.connectionprovider.EncryptedPasswordC3P0ConnectionProvider, which extends Hibernate's C3P0-based connection provider.
Hibernate will use Jasypt's DriverManager-based connection provider and is passed a set of configuration parameters which contain an encrypted value, the connection.password property. The encryptor object should be mentioned for decrypting the encrypted parameters (connection.encryptor_registered_name).
References[/size]• http://mvnrepository.com/artifact/org.jasypt
• http://camel.apache.org/jasypt.html
• http://www.jasypt.org/[/size][/size][/size][/size]
发表评论
-
java-HashMap
2014-04-09 01:17 0HashMap继承AbstractMap并实现Map接口。类图 ... -
Java中多线程与多线程同步
2014-04-07 21:25 0多线程的目的: 多线程实现了程序的并发执行。 Java 中线程 ... -
Java多线程通信
2014-04-07 21:21 459上一篇介绍Java提供synchr ... -
Java集合类(Set和List)
2014-04-07 21:15 593java提供两种存储对象的方式:数组和集合类。 两者的主要区别 ... -
Java中两个集合工具类:Collections和Arrays
2014-04-07 21:08 1136为了方便的对Array对象、Collection对象进行操作, ... -
Java-io小结
2014-04-07 20:37 480Java处理的数据流主要分为字节流和字符流。字符流处理的单元为 ... -
SQL小结
2014-04-07 16:29 568<转>[size=medium][/size] 结 ... -
hibernate缓存
2014-03-18 18:52 416hibernate缓存深入详解 -
SSH总结
2014-03-17 18:39 550struts hibernate spring -
sql order by 排序控制
2013-10-17 16:49 558SELECT * FROM table ta order ... -
在线代码格式化
2013-08-26 16:42 620http://www.ostools.net/ -
判断java中string型变量是否为空
2013-08-12 19:02 554<s:if test='actionItem.deleg ... -
多浏览器兼容问题 IE Firefox Chrome
2013-08-12 18:39 1423[size=x-large]在测试与各个浏览器兼容性的 ... -
Cron4j Scheduler
2012-07-06 18:15 3495Cron4j is a scheduler for the ...
相关推荐
Integrating Python with Leading Computer Forensics Platforms 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Apress - Office and SharePoint 2010 Users Guide - Integrating SharePoint with Excel Outlook Access and Word
Integrating Python with Leading Computer Forensics Platforms 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...
VTK 13 Integrating with the Windowing__ System.pdf VTK 13 Integrating with the Windowing__ System.pdf
sap press doc 解压密码:abap_developer
13. 与其他框架的集成(Integrating with other frameworks):Hibernate Validator提供了与其他流行Java框架的集成支持,如ORM集成、JavaServer Faces和Seam、CDI、Java EE以及JavaFX。 14. Hibernate Validator...
《Oracle Receivables Guide to Integrating Oracle Receivables with Taxware Sales/Use System Release 11i》是Oracle公司发布的一份技术指南,主要针对如何将Oracle Receivables(Oracle收款模块)与Taxware的...
SystemVerilog是一种基于IEEE标准的硬件描述语言(HDL),它在Verilog的基础上进一步发展,提供更丰富的数据类型、更强大的仿真和测试能力,并支持更复杂的系统级验证。SystemC是另一种硬件仿真语言,主要用于高层次...
Integrating Open-Source Statistical Packages with ArcGIS
hadoop 与oracle数据库的结合
Integrating Windows NT Server 4.0 with NetWare, UNIX, IBM, and
《Microsoft.Press.Integrating.PHP.with.Windows.2011》这本书主要聚焦于如何在Windows环境下有效地集成和运行PHP,以实现高效、稳定的Web应用程序开发。PHP是一种广泛使用的开源脚本语言,尤其适合用于服务器端...
C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.C# was developed by Anders Hejlsberg and his team during the development of ....
Vertica Documentation - Vertica ...Integrating with Voltage SecureData 5261 Vertica Plug-In for Informatica 5299 Vertica Error Messages 5345 Glossary 5525 Third-Party Software Acknowledgements 5643
sap press doc 解压密码:abap_developer