title: BouncyCastle signature value does not match with dotNET signature value
body: <p>I have a problem with the <code>"SHA1withRSA"</code> signature using Bouncy Castle on Android: Bouncy Castle signature value does not match with .NET signature value. </p>
  
  <p>I tried to use many algorithms like <code>"SHA1withRSA"</code>, <code>"SHA1withRSAAndMGF1"</code> or <code>"SHA1withRSA/ISO9796-2"</code> with no satisfactory results. </p>
  
  <p>If I use the same message, same algorithm and the same private key, the result must be identical in .NET and Bouncy Castle... shouldn't it? 
  Whats wrong in my code??? </p>
  
  <p>Getting the private key: </p>
  
  <pre><code>... 
  ks = KeyStore.getInstance("PKCS12"); 
  ... 
  key = ks.getKey(alias, senha.toCharArray()); 
  if (key instanceof PrivateKey) { 
      privateKey = (PrivateKey) key; 
  } 
  </code></pre>
  
  <p>Signature method: </p>
  
  <pre><code>public String signer(String txt, String alg) throws Exception { 
      Signature signer = Signature.getInstance(alg, new BouncyCastleProvider()); 
      signer.initSign(privateKey); 
      signer.update(txt.getBytes("UTF-8")); 
      return Base64.encodeToString(signer.sign(), Base64.NO_WRAP); 
  } 
  </code></pre>
  
  <p>My app must use XMLDSIG protocol to send XML to a government's web service. </p>