Solved

Database field type for AES Encryption in hex or base64

Posted on 2008-11-02
4
702 Views
Last Modified: 2012-05-05
What field type should I choose when encrypting data using AES?  I plan to use either hex or base64 encoding, and the data being encrypted is anywhere from 9 - 16 digits in length.
0
Comment
Question by:queet
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 250 total points
ID: 22865021
If ur sure about lenght u can go for varchar(maxlenght)
otherwise better to go for TINYBLOB
0
 
LVL 26

Assisted Solution

by:ushastry
ushastry earned 250 total points
ID: 22865085
Because AES is a block-level algorithm, padding is used to encode uneven length strings and so the result string length may be calculated using this formula:

16 × (truncate(string_length / 16) + 1)

In your case string_length  is anywhere from 9 - 16 digits in length.

select 16*(TRUNCATE(16/16,0)+1) from dual => 32

I suggest you to use eather varchar(32).. or varbinary..

http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html
0
 
LVL 26

Expert Comment

by:ushastry
ID: 22867267
0
 

Author Closing Comment

by:queet
ID: 31512602
Thanks!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now