Re: [sqlite] sql statement to update the data in the table
SELECT AES_ENCRYPT(password, 'abcddsfddafdasfddasd'); is work! I think I need to find out what is the data type and data lengh for storing the encrypt password Thanks, JP From: Simon SlavinTo: Joanne Pham ; General Discussion of SQLite Database Sent: Wednesday, October 19, 2011 6:24 PM Subject: Re: [sqlite] sql statement to update the data in the table On 20 Oct 2011, at 1:49am, Joanne Pham wrote: > it seems like it didn't work. > For example the password is 'password'. I ran the update statement below and > do the AES_DECRYPT the password is null instead of 'password'. Try just SELECT AES_ENCRYPT(password, 'abcddsfddafdasfddasd'); Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
On 20 Oct 2011, at 1:49am, Joanne Pham wrote: > it seems like it didn't work. > For example the password is 'password'. I ran the update statement below and > do the AES_DECRYPT the password is null instead of 'password'. Try just SELECT AES_ENCRYPT(password, 'abcddsfddafdasfddasd'); Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
On 10/19/2011 8:49 PM, Joanne Pham wrote: Yes, That is what i want but it seems like it didn't work. For example the password is 'password'. I ran the update statement below and do the AES_DECRYPT the password is null instead of 'password'. Any idea? You'll have to raise the issue with the author of custom functions AES_ENCRYPT and AES_DECRYPT. They are not part of SQLite proper, you must be using some kind of third party extension library. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
Thanks, Yes, That is what i want but it seems like it didn't work. For example the password is 'password'. I ran the update statement below and do the AES_DECRYPT the password is null instead of 'password'. Any idea? JP From: Igor TandetnikTo: sqlite-users@sqlite.org Sent: Wednesday, October 19, 2011 5:35 PM Subject: Re: [sqlite] sql statement to update the data in the table On 10/19/2011 7:23 PM, Joanne Pham wrote: > update vpn set password = AES_ENCRYPT((select password from vpn) , > "abcddsfddafdasfddasd"). I suspect you want update vpn set password = AES_ENCRYPT(password, 'abcddsfddafdasfddasd'); -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
On 10/19/2011 7:23 PM, Joanne Pham wrote: update vpn set password = AES_ENCRYPT((select password from vpn) , "abcddsfddafdasfddasd"). I suspect you want update vpn set password = AES_ENCRYPT(password, 'abcddsfddafdasfddasd'); -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
Hi Igor, update vpn set password = AES_ENCRYPT((select password from vpn) , "abcddsfddafdasfddasd"). Basically, I want to encrypt the password in vpn table so the passwords in this table are different. Above mysql statement still didn't work. Any idea. Thanks, JP From: Igor TandetnikTo: sqlite-users@sqlite.org Sent: Wednesday, October 19, 2011 3:58 PM Subject: Re: [sqlite] sql statement to update the data in the table On 10/19/2011 6:34 PM, Joanne Pham wrote: > Curently I had the table with the plain text and I want to encrypt these > passwords by using the following sql statement but I got the error mesages.. > Any suggestion? > update vpn set password = AES_ENCRYPT(select password from mytable, > "abcddsfddafdasfddasd"). Do you want vpn.password set to the same value in all rows? I would have expected a WHERE clause on the select statement that somehow correlates mytable with vpn. Anyway, the immediate cause of the syntax errors is the fact that a subselect needs to be enclosed in parentheses: update vpn set password = AES_ENCRYPT((select password from mytable), "abcddsfddafdasfddasd"); -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sql statement to update the data in the table
On 10/19/2011 6:34 PM, Joanne Pham wrote: Curently I had the table with the plain text and I want to encrypt these passwords by using the following sql statement but I got the error mesages.. Any suggestion? update vpn set password = AES_ENCRYPT(select password from mytable, "abcddsfddafdasfddasd"). Do you want vpn.password set to the same value in all rows? I would have expected a WHERE clause on the select statement that somehow correlates mytable with vpn. Anyway, the immediate cause of the syntax errors is the fact that a subselect needs to be enclosed in parentheses: update vpn set password = AES_ENCRYPT((select password from mytable), "abcddsfddafdasfddasd"); -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users