[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Md5RSASignature question

HI there,
	I am trying to verify a Md5RSA Signature but I am having trouble.  The
following code works however the verify() method returns false when I expect
it to return true.  Is there some kind of padding that I need to enforce on
line 6 or anywhere else?  Any help is appreciated, thank you


1. String test = "mmm";
2. byte[] toBeSigned = test.getBytes();

3. X509Certificate x = (X509Certificate)ks.getCertificate(alias);
4. RSAPrivateKey rsa_priv = (RSAPrivateKey)ks.getKey(alias,password);
5. RSAPublicKey rsa_pub = (RSAPublicKey)x.getPublicKey();
6. Signature hash_rsa = Signature.getInstance("Md5/RSA", "IAIK");

7. hash_rsa.initSign(rsa_priv);
8. hash_rsa.update(toBeSigned);
9. byte[] signed = hash_rsa.sign();

10. hash_rsa.initVerify(rsa_pub);
11. hash_rsa.update(signed);
12. System.out.println("Verify returned  " + hash_rsa.verify(signed));

Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce