Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • Thanks a lot..You are Right..I had done Mistake in That..But Now I am getting Exception>> System.err(416): java.security.InvalidKeyException: unknown key type passed to RSA Please Help me..Thanks in Advance.. Commented Sep 18, 2012 at 10:12
  • 3
    Thanks for that. Just one remarks: keys are symmetrical. So You can either encode with public then decode with private (make sure to whom you send encrypted data) , OR, encode with private, then decode with public (to make sure who sent you the encrypted data). Doing the 2 (with 2 different key set), allow you to enforce both 'from who' and 'to whom' security aspects.
    – Pascal
    Commented Mar 11, 2013 at 13:47
  • 3
    The "encode with private" case in known as signature. But you should never directly sign data - always sign only the has otherwise you may run into some attacks (see IT security literature).
    – Robert
    Commented Mar 11, 2013 at 15:09
  • always sign only what? Commented Jan 19, 2017 at 11:40
  • "always sign only the hash" (SHA-256 or SHA-1 or ...)
    – Robert
    Commented Jan 19, 2017 at 11:53