Link to home
Start Free TrialLog in
Avatar of Brad Bansner
Brad Bansner

asked on

decrypting an AES encrypted file in ASP

I have never worked with AES encryption before. I have files being sent to my server which are encrypted with a 128-bit key that I need to decrypt in order to extract the data. I'm really not quite sure how to proceed, the file isn't a plain text file that I can open with a text editor. So I assume I also cannot use the File System Object OpenTextFile to get access to the encrypted data. How do I even get at the data in order to decrypt it? Need a starting point. Thank you!
Avatar of Badotz
Badotz
Flag of United States of America image

It is probably a text file, and so FSO should allow you to open/read the content.

It is decrypting the content that will be the issue. There are countless examples on the web, so that part should not be too hard, either.
Avatar of Brad Bansner
Brad Bansner

ASKER

If I try to open it with a text editor, I get garbage characters:

DJ$.X0f8WáMŸa•ÅH&"ñl°¿@hn¿æ5ÀÓ+·î:õèÔ9\ $'êç`L÷ü¿

Non-ASCII. But if you think FSO will work, I will give it a try.
It isn't "garbage", it is AES-encrypted text.
OK, so I'm sort of on the right track. I setup a script to open the file with FSO:

set objFILE=objFSO.OpenTextFile

...then I did:

response.write(objFILE.ReadAll)

See attached screenshot. The top box in red is what I see if I open the file directly into a text editor. The bottom red box is the source code of the ASP page where I did the response.write above.

Shouldn't I expect these to be identical?
Picture-1.jpg
ASKER CERTIFIED SOLUTION
Avatar of Badotz
Badotz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm having a hard time finding anything that I can do a quick check with. Neither of these work:

http://www.chilkatsoft.com/js-aes-decrypt.asp
http://www.file-encrypter.com

These types of searches produce Google results that are so full of ads and spam that they're pretty much useless.

If a tool asks me to copy-and-paste text into a field in a web browser, I just open my file in a text editor, copy, then paste? It seems the encrypted data can't be moved around as easily as regular text.

If you have any other advice I would really appreciate it.
I'm not sure how much text you can decrypt here, but

http://www.movable-type.co.uk/scripts/aes.html

provides details on AES. Give it a look, and copy/paste the code into your own page to see if it will work for you.
That didn't do anything, at least with my code (when I open it to copy, it is several lines, that input field only had one).
Then perhaps "copy/paste the code into your own page to see if it will work for you."
OK, I'm going to close this out for now. Thanks for your help. At this point, I'm not even sure the file my client sent me is a valid AES encrypted file. What a mess.
Not sure I deserved points, but thanks.