spring-data-jpa-encryption-example | decrypt entity fields with JPA converters | Object-Relational Mapping library
kandi X-RAY | spring-data-jpa-encryption-example Summary
kandi X-RAY | spring-data-jpa-encryption-example Summary
An example of how to encrypt and decrypt entity fields with JPA converters and Spring Data JPA
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encrypts attribute
- Prepare and initialize the cipher
- Encrypt attribute
- Returns the cipher parameter spec for the given cipher block
- Call the given cipher
- Call the initialization of the cipher
- Get the block size of the cipher
- Decode string
- Decrypt the given string using the given cipher
- Entry point for the JPA encryption example
- Returns the date attribute as a string
- Converts dbData to an entity datetime
- Returns the entity attribute as string
- Converts a String to an EntityTime
spring-data-jpa-encryption-example Key Features
spring-data-jpa-encryption-example Examples and Code Snippets
Community Discussions
Trending Discussions on spring-data-jpa-encryption-example
QUESTION
I want to encrypt some data stored in a MySQL database using the JPA @Convert
options with an AES algorithm. In general, is working fine with all fields, but I am having issues with one of them that is a Timestamp. My version of Hibernate is 4.3.8.Final.
As it is my first time with converters, I am following this GiT example. For this test, the AES encryption is disabled, I will enable it later and is the reason which I want to convert some fields to String. Therefore the issue must be in the converter.
The entity stores a user with several typical information (name, lastname,...) and a birthdate that is stored as a Timestamp. Also, as I want to perform some search by birthdate
, I remove all hours, seconds and milliseconds for birthdate in the entity in the setter.
ANSWER
Answered 2018-May-07 at 13:06After some research. It is possible that still Hibernate has some bugs when filtering criteria with an attribute with @Convert
. I have make several tests with different options with no success at all.
As a workaround, I have changed the birthdate
attribute as a Long.
QUESTION
I have a system based on the following repository:
https://github.com/damienbeaufils/spring-data-jpa-encryption-example
To encrypt/decrypt a field on the database and it works.
But the way KeyProperty raises issues with tools like SonarQube
...ANSWER
Answered 2018-Feb-22 at 08:32But I'd say it is not mandatory that DATABASE_ENCRYPTION_KEY
is static field...
Can you change it to member variable and use getKey()
in AbstractCryptoConverter
? At a first look I do not see the reason, why it has to be static...
I have no idea what your "it doesn't work". Spring is able to inject to abstract class, that's not an issue.
I downloaded the project, converted it to Maven (I'm not Gradle guy) using https://stackoverflow.com/a/13396776/384674. Altered pom.xml is on GitHugGist if someone is interested.
What I did as a first step
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spring-data-jpa-encryption-example
You can use spring-data-jpa-encryption-example like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-data-jpa-encryption-example component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page