0 Replies Latest reply on Oct 26, 2008 10:02 PM by 807589

    byte (Java) and byte (DotNet) interoperability


      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?