On Mon, 23 Jun 2008 07:32:57 -0700 (PDT), jimgardener
<> wrote, quoted or indirectly quoted someone who
said :
>now how can i decrypt this?can i use the same keyspec as above and
>what algorithm should i use to create cipher? cipher.init (Cipher.
>DECRYPT_MODE, key) ; will cause 'InvalidKeyException: requires PBE
>parameters'
I have a similar example posted at
http://mindprod.com/jgloss/cipher.html
It uses the simpler AES algorithm, but much the same problems apply.
In the real world, you must somehow get your secret key to the other
end, perhaps by secure courier. In public/private key systems you can
exchange public keys by insecure channels, so long as you make sure
there was no tampering with a followup phone call to confirm the
digest.
JCE has methods to export keys as raw bytes. You can probable also
export them armoured in various packagings too. see
http://mindprod.com/jgloss/armouring.html
if you want experiment with manual armouring.
JCE suffers from a lack of documenation. There is no way you can do
even the simplest thing without something beyond the JavaDoc. You
can try books or googling for algorithm and method names. I learned
most from comments in various snippets of code.
see
http://mindprod.com/jgloss/jce.html
It also helps to read up on the mathematical background of the various
algorithms not so that you fully understand them,, but so at least
you have an idea of what sort of extra parms they may be hungry for.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com