Hmm....even using the CryptoStream directly and decoding just the first block (so padding wouldn't matter) my output has little resemblance to your original input.
Main Topics
Browse All TopicsI am trying to use your software to encrypt/decrypt the following which a client is sending me from Java and I am trying to decrypt in C#:
Information provided from the client:
Encryption mode: AES
Blocking mode: CBC
Padding mode: PKCS5PADDING
Test key:
933aeffebf46b9f5a54fee575d
Encrypted URL:
http://test.com/login.htm?
message decodes to:
sid=S123456&name=Fred+Smit
--------------------------
Additional Information:
The encrypted URL has 2 parameters:
" message - the AES-encrypted string in hexadecimal format
" iv - the initialization vector for this message. NOTE: the iv will be different for each message
The decrypted message is set up like URL parameters with the values UTF-8 url-encoded :
" sid - user's unique id
" name - first and last
" usertype - position code
" bucode - business unit code
" expires - timestamp (in milliseconds) when this message should expire
NOTES on the "expires" field:
" The milliseconds are counted from 1/1/1970 00:00:00 GMT
" By default, the expire time is set to 30 minutes from the point we generate the encrypted URL to account for discrepancies in system clocks. If you want to use a national time service to ensure our clocks are synched, we could decrease the amount of time allowed before expiration.
" If the message is decoded after the expiration time, it should be considered invalid and access should be denied.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
OK, I don't think you should be using System.Text.Encoding.UTF8.
byte[] FromHex(string hex)
{
if (hex.Length % 2 == 1)
{
hex = "0" + hex;
}
byte[] output = new byte[hex.Length / 2];
for (int i = 0; i < hex.Length; i += 2)
{
output[i/2] = byte.Parse(hex.Substring(i
}
return output;
}
Business Accounts
Answer for Membership
by: jensfiedererPosted on 2009-07-15 at 07:10:13ID: 24859521
You definitely want to set your blocksize to 256, otherwise you will fail setting the IV.
/KB/vb/PKS CStandard. aspx
After that....the PKCS 5 is a problem.
See
http://www.codeproject.com