This discussion is archived
3 Replies Latest reply: Oct 21, 2012 9:30 AM by sabre150 RSS

AES Encryption

842544 Newbie
Currently Being Moderated
Hello.. I'm trying to decrypt a string.

Here are the steps..

1. Decode the data. The data is base64 encoded, this should result in a byte array that gets passed to the next step.

Edited by: user11990145 on Nov 3, 2012 9:15 AM
  • 1. Re: AES Encryption
    sabre150 Expert
    Currently Being Moderated
    Though you have a line in your main program to print out the plain text you don't actually provide it! This makes it difficult for anyone to help.

    Assuming that you know for certain that your key is correct, your iv is correct and you are using CBC block mode then the only thing I can see that could be wrong is that you are not using a valid decompression.

    P.S. Please put [code ] tags round your code so that it displays better.
  • 2. Re: AES Encryption
    842544 Newbie
    Currently Being Moderated
    the forum doesn't allow me to post the string which is a xml.. not sure how to post it.. :((

    I think it's a decompression issue too.. it's compressed using DeflateStream in c#. do you know the java version of this?

    Edited by: user11990145 on Oct 21, 2012 8:56 AM
  • 3. Re: AES Encryption
    sabre150 Expert
    Currently Being Moderated
    user11990145 wrote:
    the forum doesn't allow me to post the string which is a xml.. not sure how to post it.. :((
    Convert to bytes then Base64 encode it !

    >
    I think it's a decompression issue too.. it's compressed using DeflateStream in c#. do you know the java version of this?
    Sorry no - never used DeflateStream. A quick Google search indicates that DeflateStream stream is very limited in what it can handle and I note some severe critics of it's algorithm; I have no idea how valid they are.

    To prove your basic Java decryption code is correct you could write the decrypted bytes to a file and then deflate them using C# . If this works then you have isolated the problem to the decompression.

    Edited by: sabre150 on Oct 21, 2012 5:28 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points