I want to write a password based encryption and decryption in Java!
It means that I have a K (Password)
and P (plain Text)
and create such an E (encrypted Text)
that I can then decrypt that E
with my first K
.
As I mentioned from the questions and their answers in StackOverflow like here
and here
my solution is PKCS5 but they firstly generate K1
from K
and then encode that K1
and generate K2
from K1
. and then encrypt P
and decrypt E
with that K2
.
But It's not what I want. Each time you generate K2
from K
, the new K2
differs from last K2
so you can't decrypt with a new K2
an encrypted text that encrypted with previous K2
.
How can I code this scenario in Java ?