Browse Source

never return null for kdfType

pull/5/head
Herbert Poul 3 years ago
parent
commit
6c477ec240
  1. 11
      lib/src/crypto/key_encrypter_kdf.dart

11
lib/src/crypto/key_encrypter_kdf.dart

@ -76,18 +76,15 @@ class KeyEncrypterKdf {
return KdbxUuid(uuid); return KdbxUuid(uuid);
} }
static KdfType? kdfTypeFor(VarDictionary kdfParameters) { static KdfType kdfTypeFor(VarDictionary kdfParameters) {
final uuid = KdfField.uuid.read(kdfParameters); final uuid = KdfField.uuid.read(kdfParameters);
if (uuid == null) { if (uuid == null) {
throw KdbxCorruptedFileException('No Kdf UUID'); throw KdbxCorruptedFileException('No Kdf UUID');
} }
final kdfUuid = base64.encode(uuid); final kdfUuid = base64.encode(uuid);
try { return kdfUuids[kdfUuid] ??
return kdfUuids[kdfUuid]; (() => throw KdbxCorruptedFileException(
} catch (e) { 'Invalid KDF UUID ${uuid.encodeBase64()}'))();
throw KdbxCorruptedFileException(
'Invalid KDF UUID ${uuid.encodeBase64()}');
}
} }
final Argon2 argon2; final Argon2 argon2;

Loading…
Cancel
Save