PBKDF2WtihHmacSHA1
.
7. Pass the
pbKeySpec
to the
secretKeyFactor.generateSecret
method and
assign the
encoded
property which returns the key in bytes.
8. Finally,
keySpec
is produced to use when you initialize the
Cipher
.
All of these steps seem a bit complex, but it’s the kind of thing that’s always the
same to use; only the data changes. There are still a few steps to do, so let’s get to it!
Using an ini/aliza/on vector
The recommended mode of encryption when using AES is the
cipher block
chaining
, or
CBC
. This mode takes each next unencrypted block of data and uses the
XOR
operation with the previous encrypted block. One problem with this procedure
is that the first block is less unique as subsequent blocks. If one encrypted message
started the same as another message, the beginning blocks of the two messages
would be the same. This would help an attacker to find out what the message(s) are.
To solve this problem, you’ll create an
Do'stlaringiz bilan baham: |