Em domingo, 13 de janeiro de 2013 10h22min21s UTC-2, mbarbiero escreveu: > > Hi... > I have a problem in SHA1withRSA signature using BouncyCastle on Android: > BouncyCastle signature value does not match with dotNET signature value. > I tryed to use many algorithms like "SHA1withRSA", "SHA1withRSAAndMGF1" or > "SHA1withRSA/ISO9796-2" with no satisfactory results. > If I use the same message, same algorithm and the same private key, the > result must be identical in dotNet and BoucyCastle... is it? > Whats wrong in my code??? > > *Getting the privateKey:* > ... > ks = KeyStore.getInstance("PKCS12"); > ... > key = ks.getKey(alias, senha.toCharArray()); > if (key instanceof PrivateKey) { > privateKey = (PrivateKey) key; > } > > *Signature method: > * > 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); > } > > > ps. My app must use XMLDSIG protocol to send XML to a government's > webservice. > > Thanks in advance. >
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en