K
kerberos
Hello,
I'm working on porting some Java code to C# and I've run into a
glitch. I have a Java function that does a lot of bit shifting and
builds a byte[] array with values like the following:
10 42 106 -22
18 18 18 -110
18 50 114 114
2 34 34 34
... etc ..
(Apparently Java considers all bytes to be signed.)
Unfortunately, with C# and DESCryptoServiceProvider, everything is a
byte[] and I need to have sbyte[] instead. Merely recasting obviously
doesn't fix issues with CryptoStream(...) and friends. Since I need
to encrypt a key that includes signed bytes, this obviously creates a
problem because the bytes that need to be signed are converted to
unsigned in C#. This causes my keys to not match what was created in
Java.
What would you recommend to make this go in C#? Should I be
overriding DESCryptoServiceProvider or is there another solution?
I'm working on porting some Java code to C# and I've run into a
glitch. I have a Java function that does a lot of bit shifting and
builds a byte[] array with values like the following:
10 42 106 -22
18 18 18 -110
18 50 114 114
2 34 34 34
... etc ..
(Apparently Java considers all bytes to be signed.)
Unfortunately, with C# and DESCryptoServiceProvider, everything is a
byte[] and I need to have sbyte[] instead. Merely recasting obviously
doesn't fix issues with CryptoStream(...) and friends. Since I need
to encrypt a key that includes signed bytes, this obviously creates a
problem because the bytes that need to be signed are converted to
unsigned in C#. This causes my keys to not match what was created in
Java.
What would you recommend to make this go in C#? Should I be
overriding DESCryptoServiceProvider or is there another solution?