Here is the setup:
I create public/private key pair with .NET, I want to sign a string. I take a random string, get a byte[] from it, sign it, and take the signature in the java app. I want to verify it in java ( (!)I'm talking about Android's java).
The process to take the public key to Java environment: When I create the public key, I take the byte arrays for the public key (P, Q, G, Y) and create PublicKey in Java with those values. P, Q, G, Y in .NET are byte[], I convert them to sbyte[] and use these sbyte[] in Java, creating big integers:
byte[] byteP = new byte[] { -34, ...... -117 };
...
BigInteger p = new BigInteger(1,byteP);
...
new DSAPublicKeySpec(y, p, q, g);
To test the process, I take the signature byte[] from C#, convert it to sbyte[] and then use it in Java.
The problem is, I cannot verify the signature string later. I got
java.security.SignatureException: signature bytes have invalid encoding
Any ideas appreciated! (Like, a better, entirely different way to do the whole thing ;) )