Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Aes_encrypt Aes_decrypt Problem


I'm using PHP 4 with mySQL. I'm using aes_encrypt and _decrypt to store customer information as securely as possible. The problem crops up when I go to store (or retrieve -- I'm not sure which) the state that the customer lives in.

AL works for Alabama
GA works for Georgia
fl works for Florida
FL returns an empty string.

Does anyone have any ideas on what's happening here?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
AES_ENCRYPT And AES_DECRYPT
I have recently updated my system from using MySQL 4.0 to MySQL 5.0. The thing is, none of the encrypted fields are being decrypted correctly when using Connector/J. I did get the newest version of it but still no luck.

Select * When Using AES_DECRYPT
If all my columns are encrypted, is it true that I can not use a simple
'select * from' anymore. Instead I need to do:

select AES_DECRYPT( column1 , 'mykey' ), AES_DECRYPT( column2 ,
'mykey' ),
AES_DECRYPT( column3_etc... , 'mykey' )

This would make my code rather long . Is there a shortcut I am missing?

AES_DECRYPT Issue (some Rows Don't Decypt)
I have a problem. I use AES to encrypt 15 digits numbers in the table. To encrypt I do this:

UPDATE table_a
SET hash = AES_ENCRYPT(number,'salt_blah'), number = '' ;
To decrypt I do this:

UPDATE table_a
SET number = AES_DECRYPT(hash ,'salt_blah')
The problem is that mysql fails to decrypt some rows, but not all the time. If I encrypt and decrypt right away, it works fine. But old data with same hash doesn't decrypt.
I usualy work in Navicat, so I ditched that for standard command line with no success, it does the same thing.

AES_ENCRYPT
try following statement from mysql command line client

select AES_ENCRYPT('company','zyxwvutsrqponmlk');


everything goes haywire when I try to use AES_ENCRYPT .

Using AES_ENCRYPT For 256 Bit Encryption
I just started using AES_ENCRYPT to encrypt records in my databases. For the most part, the default 128 bit encryption is fine. But, I would like to use 256 bit for one of my forms. According to the MySQL documentation you can use the function for either 128 or 256 but I don't understand how to get it to do 256.

The documentation says:"Encoding with a 128-bit key length is used, but you can extend it up to 256 bits by modifying the source." - http://dev.mysql.com/doc/refman/4.1/...functions.html

What source do I have to modify to get it to use 256?

AES_ENCRYPT Function
Essentially I am playing around with the aes_encrypt fucntion to securly store some data in the db. The problem I am having is that I get the following error : Data truncated for column 'foo' at row 1 and the table creating was done with:

CREATE TABLE `foobar` (
`foo` varchar(10000) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8

with a varchar(10000) and doing and AES_ENCRYPT('foo','bar') one would think that it would work. But I suspect that I am doing something incorrectly.

Aes_encrypt Values
I guess if explain my situation first it should help a little better...

I have a table with some empty fields and some numbers I wish to encrypt.
I perform a select statement to check how many fields are not empty (I get 56), e.g

"SELECT number from customer WHERE NOT number = '' ";

I then encode this using AES_ENCRYPT(number,keystr)

Then try the count query again as written above but this time I have fewer entries (I get 3) that are not empty.

Which is odd because I can then decrypt these records and I get my 56 records back again.

Any ideas why this may be?
I am using tiny blob as the field by the way, do I need to perform some sort of php string function on the numbers before storing them do you think?

Query Error (AES_ENCRYPT)
I havae a user database set up where the passwords are encrypted using AES_ENCRYPT with the date the user joined being the salt for each user.  The inserts work fine for the password, but for some reason I'm getting an error on this statement below when I try to update....

update users set password = AES_ENCYPT('123456', '2005-09-15 22:11:06') where user_id = '806'

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('123456', '2005-09-15 22:11:06') where user_id = '806'' at line 1

Any idea what is going on here?

BTW... the password field is set up as a BLOB.

AES_ENCRYPT In Visual Basic
I'm writing an app with vb & mysql.

for the user login - i tried aes_encrypt and vb reports function or sub not defined.

How To Calculate The Size Of An AES_ENCRYPT() Result
what I want is to calculate the result string for an AES_ENCRYPT() function, in the mysql manula says:the result string length may be calculated as 16*(trunc(string_length/16)+1) but I dont know what value trunc has.

Could any one please explainme how to calculate the max size of an 10 chars max wide password value?


Copyright © 2005-08 www.BigResource.com, All rights reserved