0 Replies Latest reply: Oct 26, 2008 5:02 PM by 807589 RSS

    byte (Java) and byte (DotNet) interoperability

    807589
      Hi!


      I have the following problem. In DotNet platform I am encrypting using RijndaelManaged, from System.Security.Cryptography, which uses AES encryption method. In Java platform I use the javax.crypto.Cipher, in order to decrypt the message (in byte[] array) encrypted in DotNet platform. The problem is that in DotNet there isn´t an AES encryption that uses bytes from -128 to 127. The DotNet´s RijndaelManaged uses the byte type. In that platform, the byte type can have values from 0 to 255. I have already tried to convert byte to sbyte (signed byte), trying to make it equivalent to the byte type from Java, but when the message arrives in the Java platform the javax.crypto.BadPaddingException is thrown, with the message "Given final block not properly padded".


      How can I solve the problem?

      Thanks!