hibernate-encrypt

Hibernate encryption library

Лицензия

Лицензия

Категории

Категории

Сеть Hibernate Данные ORM
Группа

Группа

net.zubial
Идентификатор

Идентификатор

hibernate-encrypt
Последняя версия

Последняя версия

1.4
Дата

Дата

Тип

Тип

jar
Описание

Описание

hibernate-encrypt
Hibernate encryption library
Система контроля версий

Система контроля версий

https://github.com/zubial/hibernate-encrypt

Скачать hibernate-encrypt

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.zubial/hibernate-encrypt/ -->
<dependency>
    <groupId>net.zubial</groupId>
    <artifactId>hibernate-encrypt</artifactId>
    <version>1.4</version>
</dependency>
// https://jarcasting.com/artifacts/net.zubial/hibernate-encrypt/
implementation 'net.zubial:hibernate-encrypt:1.4'
// https://jarcasting.com/artifacts/net.zubial/hibernate-encrypt/
implementation ("net.zubial:hibernate-encrypt:1.4")
'net.zubial:hibernate-encrypt:jar:1.4'
<dependency org="net.zubial" name="hibernate-encrypt" rev="1.4">
  <artifact name="hibernate-encrypt" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.zubial', module='hibernate-encrypt', version='1.4')
)
libraryDependencies += "net.zubial" % "hibernate-encrypt" % "1.4"
[net.zubial/hibernate-encrypt "1.4"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
commons-io : commons-io jar 2.3
org.apache.commons : commons-lang3 jar 3.2.1
org.hibernate : hibernate-core jar 5.1.0.Final
org.apache.logging.log4j : log4j-core jar 2.8.2

Модули Проекта

Данный проект не имеет модулей.

Java Hibernate Encryption library

This library brings new types field for hibernate mapping. These types allow encoding and decoding Text fields.

Searches on these fields remain possible, but only in equal (case-sensitive). It is advisable to manage the case at insertion.

Used with Spring 4 / Hibernate 5 / Oracle db

ChangeLogs

1.x

  • Initial commit

Usage

  • Dependency
    <dependency>
        <groupId>net.zubial</groupId>
        <artifactId>hibernate-encrypt</artifactId>
        <version>1.4</version>
    </dependency>
  • Declare the Encryptor pool as a new bean (Spring applicationContext)
    <bean id="hibernatePoolEncryptor"
          class="net.zubial.hibernate.encrypt.impl.PBEHibernatePoolStringEncryptor">
        <property name="registeredName">
            <value>hibernatePoolEncryptor</value>
        </property>
        <property name="algorithm">
            <value>[algorithm, default AES/CBC/PKCS5Padding]</value>
        </property>
        <property name="messageCharset">
            <value>[messageCharset, default UTF-8]</value>
        </property>
        <property name="passwordPathfile">
            <value>[textfile included password]</value>
        </property>
        <property name="password">
            <value>[if you don't use a textfile]</value>
        </property>
        <property name="poolSize">
            <value>[size of the pool, default 4]</value>
        </property>
        <property name="enable">
            <value>[true or false]</value>
        </property>
    </bean>
  • Declare new Hibernate type (package-info.java inside hibernate entities package)
    @TypeDefs({
            @TypeDef(name = "encryptedString", typeClass = PBEHibernateStringType.class, parameters = {
                    @Parameter(name = "encryptorRegisteredName", value = "hibernatePoolEncryptor")
            }),
            @TypeDef(name = "encryptedNationalized", typeClass = PBEHibernateNationalizedType.class, parameters = {
                    @Parameter(name = "encryptorRegisteredName", value = "hibernatePoolEncryptor")
            })
    })
    package com.your.package.hibernate;
  • Declare encrypted fields (Hibernate mapping)
    @Column(name = "USER_NAME")
    @Type(type = "encryptedString")
    private String userName;

Версии библиотеки

Версия
1.4