Encrypt within the Database

Asked

Viewed 47 times

0

Hello! I’m making a process for entering user data and would like to know how to encrypt the password field within the process. My table:

create procedure cadUsuario(
@nome varchar(100),
@email varchar(150),
@data date,
@cpf int, 
@rg int,
@senha varchar(100))
as begin 
    
    insert into 
    tb_usuario(nm_usuario, nm_email, dt_nasc, cd_cpf, cd_rg, nm_senha) 
    values (@nome, @email, @data, @cpf, @rg, @senha)
end
go
  • Encryption is usually done outside the SQL environment. The database already receives the encrypted data and the server encrypts it. By doing the cipher inside SQL you will be vulnerable to inserting corrupted information, hacking, decryption, etc.

  • then, at the time I give a get on what the user entered, I will need to encrypt and then enter this value in the bank?

  • Basically yes, and similarly you must decrypt when you get the database data. Be careful with SQL Injection when making queries.

  • 1

    All right! Thank you!

No answers

Browser other questions tagged

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