AES_ENCRYPT() / AES_DECRYPT() question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus

    AES_ENCRYPT() / AES_DECRYPT() question

    Hello,

    I have been storing passwords in my database via AES_ENCRYPT and using
    AES_DECRYPT if I need to retrieve them in readable form. For the most
    part everything works fine, but I noticed that a few entries when
    returned using AES_DECRYPT register as NULL.

    The column in question is of type TINYBLOB, and has a NOT NULL
    constraint. Passwords are all between 6 and 10 characters in length.
    When I searched the net for similar problems, most other people reported
    using some sort of TEXT type, and I am aware of the problem with TEXT
    types and uneven padding, but I don't think that is my problem here
    since I am using a TINYBLOB.

    So here are my questions...

    1) Is TINYBLOB too small for some reason, and should I instead use BLOB?
    I would rather save disk space if possible using TINYBLOB especially
    since the max an entry can be is 10 characters, and the great majority
    of my rows are correct, but I haven't been able to rule out this as the
    problem

    2) How can these fields be NULL if I have a NOT NULL constraint, is it
    because the DB is looking at the TINYBLOB object and treating that as
    something that is NOT NULL?

    3) If I do need to change the column type to BLOB, will my current
    TINYBLOBs transfer fine via a simple alter table ... modify column ...
    query or will there be some padding issues?

    Thanks a bunch in advance for all your help.
Working...