feck Posted January 6, 2007 Share Posted January 6, 2007 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 More sharing options...
feck Posted January 6, 2007 Author Share Posted January 6, 2007 Solved it: SELECT password, AES_DECRYPT(password, 'password') AS unencrypted FROM staff where password in AES_DECRYPT, (sorry, the first one that is,) is actually the colum name,if that makes any sense. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now