Skip to content
Advertisement

Creating ASN1 encoded signature in C# to send to Java

I have a private/public secure cert. My Java counterparts have the public key. I have the need to take a string, sign it, and send it along to Java to then verify the data and signature.

There appears to be a well known issue with how Microsoft and the rest of the world encodes/signs data, something about the way bytes are handled. It’s so well known, that I can’t find a solution. If they take my string and the private key, they can obviously sign it correctly, and verify it. If I take my string, I can sign and verify it within .Net fine. I have seen a slew of methods for converting from ASN1 to Microsoft’s format (I think P1363), but not converting from Microsoft, C#, to ASN1 for Java. I don’t what is going on well enough to understand how to reverse engineer.

I’ve explored http://www.codeproject.com/Articles/25487/Cryptographic-Interoperability-Keys but the final result wasn’t what the java side needed. I can sign a string, and I get a signature, but Java guys are telling me it needs to start with MC, first bytes are indicators. I am not seeing this.

Thanks!

Advertisement

Answer

A solution has been found, and looks like some of the other examples I’ve been seeing, but for some reason this works better: (method named after the guy who solved it for me 😉

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement