How to encrypt in the Java Web project

Asked

Viewed 183 times

2

Can someone pass me some material with the safest way to make the security of a system?

I want to put this in the user registration in my JSF project with Primefaces 5.1 for when it is registered save the password already encrypted in the database.

  • I looked for JSF encryption on Google and found several links. Including video in Portuguese. However, think that it is indifferent to be JSF or MVC or anything else.

1 answer

0

You can use the lib Bcrypt.

// criptografando  
password = BCrypt.hashpw(password, BCrypt.gensalt());
// verificando se são a mesma senha
BCrypt.checkpw(password, userCheck.getPassword(); // retorna true/false

Currently I use it in my java projects, very secure, one detail is that in no way can you decrypt the password. You can only compare a String with an already encrypted password

Browser other questions tagged

You are not signed in. Login or sign up in order to post.