ToDo
ToDo

Reputation: 782

Encrypt and decrypt text in MySQL (possibly with Java)

I'm using Angular, Java, and MySQL to build a secure web application.

I want to save encrypted text to the database and decrypt it in Java. This means that anyone accessing the database (e.g. database administrator/developer) will not see sensitive information, except for the owner of the text by using the web application.

I am aware of one way hashing methods which can be used for passwords but it cannot be decrypted back to its original form.

Upvotes: 1

Views: 3711

Answers (1)

Teo
Teo

Reputation: 3213

The hash function doesn't permit the decryption.. Indeed it return a digest.. And the force of the hash is that it should be impossible obtain from the digest the original data.

If you want encrypt and decrypt you could an algorithm that do it, like AES and implement it.

I search just few seconds, here an example: https://www.quickprogrammingtips.com/java/how-to-encrypt-and-decrypt-data-in-java-using-aes-algorithm.html

Otherwise here another example: https://howtodoinjava.com/security/java-aes-encryption-example/

Then after you obtain your encrypted data you can save them using your method to access to the database

Upvotes: 2

Related Questions