make the iteration count for PBKDF2 configurable per-device

This commit is contained in:
Michele Balistreri
2019-03-20 13:18:24 +03:00
parent f603979cb5
commit b249bd75e6
3 changed files with 18 additions and 1 deletions
@@ -181,7 +181,7 @@ public class KeycardCommandSet {
try {
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256", "BC");
PBEKeySpec spec = new PBEKeySpec(pairingPassword.toCharArray(), "Keycard Pairing Password Salt".getBytes(), 50000, 32 * 8);
PBEKeySpec spec = new PBEKeySpec(pairingPassword.toCharArray(), "Keycard Pairing Password Salt".getBytes(), apduChannel.pairingPasswordPBKDF2IterationCount(), 32 * 8);
key = skf.generateSecret(spec);
} catch (Exception e) {
throw new RuntimeException("Is Bouncycastle correctly initialized?");