Solved

Database field type for AES Encryption in hex or base64

Posted on 2008-11-02
4
708 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
K V 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:Umesh
Umesh 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:Umesh
ID: 22867267
0
 

Author Closing Comment

by:queet
ID: 31512602
Thanks!
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

627 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