El sábado, 30 de marzo de 2013 18:27:32 UTC+1, Manuel Alejandro Fernandez Casado escribió:
Hi.--I´m using GWT 2.5 and I´m trying to sign a text, that is always the same.Code (exceptions ommited):public String sign(String text) {String sign = null;Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(privKey);signer.update(text.getBytes()); sign = Base64Utils.toBase64(signer.sign()); return sign;}I put some System.out.println to see values. First are 8 first bytes from clear text (variable text). Second is clear text passed to base64 using Base64Utils (just in case Base64Utils returns different values). Third is 8 first bytes from signed text.I put different executions:Execution 150,57,54,35,49,35,49,51MjI5NiMxIzEzNjU4Mzk0OTc5MzIjU0hBMXdpdGhSU0EjMTI3LjAuMC4xI3R1 c2N1aWRhZG9yZXMuY29tIw== 11,82,116,126,85,-101,80,94Execution 250,57,54,35,49,35,49,51MjI5NiMxIzEzNjU4Mzk0OTc5MzIjU0hBMXdpdGhSU0EjMTI3LjAuMC4xI3R1 c2N1aWRhZG9yZXMuY29tIw== -110,27,121,116,7,-99,-78,56Execution 350,57,54,35,49,35,49,51MjI5NiMxIzEzNjU4Mzk0OTc5MzIjU0hBMXdpdGhSU0EjMTI3LjAuMC4xI3R1 c2N1aWRhZG9yZXMuY29tIw== 33,-77,-128,14,-24,-38,93,124I can´t put private key but I can assure you (breakpoint see) that is always the same.So problem is clear. The method Signature.getInstance is returning a different Signature construction that makes signed text different each time.Does anyone know why this happens?Thanks in advance.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment