Jump to content

Encryption problem


feck

Recommended Posts

Hicompletly new to sql encryption wanted to know how to use the ael encryption methodAES_ENCRYPT(str,key_str), AES_DECRYPT(crypt_str,key_str)First of all, the str value in the above AES_ENCRYPT function, is that the actual value I'm passing in.In my case for testing its 'bob' and my key_string is 'password'I have a table with only 2 colums for testing purposes, staff = table namestaffID + password = colum namesI've successfully inserted values into database

INSERT INTO staff VALUES ('bob',AES_ENCRYPT('bob','password'));

and when i use:

select * from staff2

this shows the password colum with one encrypted value and obviously the staffId as bobNow how do I create a query to retrieve these colums with the password colum decrpyted, ive tried something like this:

SELECT password, AES_DECRYPT('bob', 'password') AS unencrypted FROM staff

but the result shows the password colum encryted as I suppose it should and the new unencrypted colum as blank. can anybody help, also need some good tutorials on this sort of encryption.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...