I have this code snippet to generate key with PBKDF2.
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, length);
SecretKey key = skf.generateSecret(spec);
byte[] res = key.getEncoded();
I am wondering how generating works when a key lengthis longer than specified SHA digest algorithm type?
For example - what happens when I set a key length of 1024 bits and use PBKDF2WithHmacSHA512
algorithm? Where are 512 bits generated?