title: DSA problem - create DSA public/private key with .NET, use the public key with Java(android)
body: <p>Here is the setup:</p>
  <p>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).</p>
  <p>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:</p>
  <blockquote>
  <p>byte[] byteP = new byte[] { -34, ...... -117 };</p>
  <p>...</p>
  <p>BigInteger p = new BigInteger(1,byteP);</p>
  <p>...</p>
  <p>new DSAPublicKeySpec(y, p, q, g);</p>
  </blockquote>
  <p>To test the process, I take the signature byte[] from C#, convert it to sbyte[] and then use it in Java.</p>
  <p>The problem is, I cannot verify the signature string later. I got</p>
  <blockquote>
  <p>java.security.SignatureException: signature bytes have invalid encoding</p>
  </blockquote>
  <p>Any ideas appreciated! (Like, a better, entirely different way to do the whole thing ;) )</p>