This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Use the getEncoded() method to get the byte from the keys. To go the other way, getting an RSAPublicKey or RSAPrivateKey from a byte, use the appropriate KeyFactory methods and encoded key specs, e.g. for RSAPrivateKey
and for RSAPublicKey
I succeed in storing and retreiving the private key as in the first example. But when I try the public key conversion from byte array to a PublicKey object I get the following exception:
Somebody have a clue why the PublicKey example does not work?