Thomas’ Developer Blog

February 16, 2008

AES_DECRYPT non-bug bug in mySQL

Filed under: Asp.Net Framework 2.0, sql — Tags: , , , , , — sanzon @ 7:10 am

Well I ran into a small problem recently, kind of your typical issue of skipping over something small.

 When you use AES_DECRYPT in mySQL you’ll run into an issue with sending it over ASP.NET this is because .NET has some issues with BLOB types.. basically .Net doesn’t like BLOBs.

 So to fix this small error, instead of having th typical code:

Select AES_DECRYPT(column,’myKey’) As alias FROM table;

Change it to:

Select CAST(AES_DECRYPT(column,’myKey’) AS CHAR(#)) AS alias FROM table;

 All this does is cast/convert the BLOB into a char string which .NET can easily handle!  Hope this helps anyone who runs into this issue.

Advertisements

9 Comments »

  1. Thanks for your post, it was very helpful

    Comment by Cesar — September 29, 2008 @ 5:42 am

  2. thank you very much!!!!

    Comment by Anonymous — November 2, 2011 @ 11:32 pm

  3. Thanks, It helped me a lot :)

    Comment by shaoxy — July 5, 2012 @ 12:01 pm

  4. I couldn’t refrain from commenting. Perfectly written!

    Comment by how to configure best buying a wireless cable modem for — August 25, 2014 @ 2:56 am

  5. It’s really a great and helpful piece of info.
    I am glad that you shared this useful information with us.

    Please stay us informed like this. Thanks for sharing.

    Comment by how to configure best comcast best best cable modem for — September 11, 2014 @ 10:46 am

  6. What’s up to every body, it’s my first go to see of this web site; this web
    site includes awesome and in fact fine data for visitors.

    Comment by how to configure best cable the best cable modem for — September 12, 2014 @ 10:47 am

  7. My partner and I stumbled over here different page and thought I should
    check things out. I like what I see so i am just following you.
    Look forward to exploring your web page again.

    Comment by how to configure best buy buy cable modem for comcast — September 25, 2014 @ 9:35 am

  8. Hola! I’ve been following your blog for
    a long time now and finally got the courage to go ahead and give you a shout out
    from Atascocita Tx! Just wanted to mention keep up the fantastic job!

    Comment by how to configure best cable how to configure modem linux — September 30, 2014 @ 6:22 pm

  9. Just want to say your article is as amazing. The clearness in your post is simply cool and i could assume you are an expert on this subject.
    Fine with your permission let me to grab your feed to keep updated
    with forthcoming post. Thanks a million and please continue the gratifying work.

    Comment by Insurance coral springs — October 14, 2014 @ 3:58 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: