Help please: Encrypt, save to file, then decrypt later to read
posted 6 years ago
I'm new to encrypting data in JAVA, have spend a few days reading up about it
and trying several methods, the methods I have got to work have pretty weak encryption.
The code below is one I'd really like to get working properly but seem to be having trouble with
Any point in the right direction, or what I am doing wrong would be great help.
This code - Works fine.
The trouble is I want to write the encrypted message into a text file, then read it again
from another class.
So I tryed this below, tryed break down the key, then trying to rebuild the key (so I can
use it in another class once I get this right)
As you can see down the bottom, the first "Text Decryted : " Message will only show the
message it originally generate for this instance.
BUT the second one fails when it trys to Decrypt the code I have given it from class, the key
I've used with the 2nd one I have taken from another instance of running the program (the one
were I got the encrypted message to be decryted)
Do you think I'm going about this the right way, am I getting warm with it?
Is there a better way to be doing this?
Basically I want to take a string, encrypt it, save that to a text file, then decrypt it to read it