• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

difference between MD5withRSA and RSA?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I would like to know if there is a difference between signing a String with RSA and with signing it with MD5withRSA. I am trying to sign a small String "config" with my PKCS12 certificate. I get my keystore with :
KeyStore ks = KeyStore.getInstance("PKCS12", "SunJSSE");
FileInputStream fin = new FileInputStream(new File("itdemo4.pfx"));
ks2.load(fin, "demo4".toCharArray());
after which i get the PrivateKey which i use to initialise the Signature as so :
PrivateSignature privateSignature = Signature.getInstance("MD5withRSA");
privateSignature.initSign(privateKey);
and then sign my String :
privateSignature.update("config".getBytes());
byte[] signedConf = privateSignature.sign();
when i save my result to a file and compare it to the same result a collegue gets using MS and Capicom they are hugely different. For example mine is about 3 lines long and his is about 20. What I would like to know is is there a difference between the RSA that he's using and the RSAwithMD5 that I am that would cause such a huge difference in the results? And would I need to loop through my result converting the individual byte to hex string before i post it to the IIS server?
any help would be greatly appreciated.
Thanks,
Joe
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joe Wilkinson:
...difference between signing a String with RSA and with signing it with MD5withRSA...


RSA is an encryption algorithm while MD5 is a hash algorithm. Now "MD5withRSA" refers to a signature algorithm where hashing is performed using MD5 and encryption/decryption is performed using RSA.
To my knowledge (which is less than extensive on this subject) you can't sign anything with an encryption algorithm alone. I could be wrong though.
reply
    Bookmark Topic Watch Topic
  • New Topic