Tales from the javax.Crypto
Posted on 2004-10-03
okay, I want people to be able to push a button, this button will encrypt the contents of a file, say C:\oogyboogey.txt
then I want them to be able to decrypt the file using a, guess what. decrypt button.
So while this seems utterly obvious and trivial, I'm confused about the whole dam javax.crypto thing , or cipher or something.
I do understand one thing, you need a key to do it. so here is my 30 digit sample key:
Push Encrypt button
- open encryption dialog (so they can choose form of encryption)
- load contents of file to String 'fileContents'
- encrypt String (create new encrypted string 'file-enc')
- save new String to file
Push Decrypt button
- open decryption dialog (so they can choose form of decryption)
- load contents of file to String 'fileContents-dec'
- encrypt String (create new encrypted string 'file-dec')
- open string in JEditorPane 'contentarea'
HOW YOU CAN HELP:
Simply hand over some source code.
No need to add the Action Listeners for the buttons, just what I should put inside them.
Well, I want to prevent people from pushing the 'Encrypt' button twice and messing the whole file up.
I'm just wonderimg, if you encrypt 2 times and then decrypt 2 times, do you get the same thing back? If you can answer this too, I may favor your solution :)