mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-15 22:42:51 +00:00
Abort andOTP import early if number of iterations is suspicious
This commit is contained in:
parent
ee6a020f4d
commit
0112431269
1 changed files with 6 additions and 0 deletions
|
@ -123,6 +123,12 @@ public class AndOtpImporter extends DatabaseImporter {
|
|||
if (iterations < 1) {
|
||||
throw new DatabaseImporterException(String.format("Invalid number of iterations for PBKDF: %d", iterations));
|
||||
}
|
||||
// If number of iterations is this high, it's probably not an andOTP file, so
|
||||
// abort early in order to prevent having to wait for an extremely long key derivation
|
||||
// process, only to find out that the user picked the wrong file
|
||||
if (iterations > 10_000_000L) {
|
||||
throw new DatabaseImporterException(String.format("Unexpectedly high number of iterations: %d", iterations));
|
||||
}
|
||||
|
||||
byte[] salt = Arrays.copyOfRange(_data, INT_SIZE, INT_SIZE + SALT_SIZE);
|
||||
return new KeyDerivationParams(password, salt, iterations);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue