Cryptographic provider that support both Java and Microsoft

Cryptographic provider that support both Java and Microsoft

Post by Eugene May » Wed, 19 May 2004 01:23:54


Hello!
You wrote on 17 May 2004 08:47:56 -0700:

GA> Does anyone know any providers that support both Java platform and
GA> Microsoft ASP and .Net. We are trying to use Bouncy Castle's AES on
GA> Java side and Xceed's AES to decrypt from ASP side and due to
GA> different character/unicode presentation we are unable to decrypt. Any
GA> thoughts?

AES doesn't deal with Unicode. The only possible issue is byte order for IV
or for the key (especially after key expansion). You should check this first
of all, i.e. try to play with byte order.

Eugene Mayevski
EldoS Corp., CTO
Networking and security solutions, custom development services
http://www.yqcomputer.com/
 
 
 

Cryptographic provider that support both Java and Microsoft

Post by Murra » Wed, 19 May 2004 20:01:18


Any
IV
first

As Eugene said, AES and indeed most encryption algorithms deal purely with
bytes which is past the point where charsets matter. If you're dealing with
Strings, the problem could be where you convert to bytes and vice versa.
e.g. if you're doing string.getBytes() this will use the default character
set which will vary depending on your OS, location and/or JVM settings. I
think this is usually ISO-8859-1 for Unix and often cp1252 for Windows.
Whatever it is, it's not guaranteed to be the same across multiple systems
or runtime environments.

Basically you need to choose an appropriate charset and use it consitently
on both apps.
e.g.
bytes = string.getBytes("ISO-8859-1");
stringed = new String(bytes, "ISO-8859-1");

I assume there'd be a way to specify this in ASP too ...

HTH