I have to use DES Encryption.
But the Key is coming from C# code. And that is having double Bytes Character.
So when i am using that Key in my code, i am getting Key Length more than what i need.
Eg. Key coming from C# code :- zkouškaa, Which returns me Bytes :- 122, 107, 111, 117, -59, -95, 107, 97, 97.
Since in C# it takes the bytes as unsigned , there String is returning only 8 bytes that can be used to construct key. But With Java its returning 9 Bytes , which is making the Problem.
Can anyone please help me with the Issue.
I have one more thing.
The Key coming is in Hexa Format, so is there any way that i can directly use Hex String as Key?
Would that be better or Possible?.
I might be mistaken, but I believe C# encodes the String to bytes in an encoding different from Java. If you use an encoding that can represent all the characters (eg. Unicode) on both platforms, I believe you'll get the same bytes out. Java's String class has several overloaded getBytes() methods, some of which allow you to specify the encoding (charset). I don't know how to do that in C#, though.