From be9103ad910a5cd0fa4125fe61676f31b3a5d052 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Tue, 18 Aug 2020 16:12:32 +0200 Subject: [PATCH] expose v3 TransformRounds for aes kdf. --- lib/src/kdbx_format.dart | 3 +-- lib/src/kdbx_header.dart | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/kdbx_format.dart b/lib/src/kdbx_format.dart index a542392..1746d17 100644 --- a/lib/src/kdbx_format.dart +++ b/lib/src/kdbx_format.dart @@ -698,8 +698,7 @@ class KdbxFormat { static Future _generateMasterKeyV3( KdbxHeader header, Credentials credentials) async { - final rounds = ReaderHelper.singleUint64( - header.fields[HeaderFields.TransformRounds].bytes); + final rounds = header.v3KdfTransformRounds; final seed = header.fields[HeaderFields.TransformSeed].bytes; final masterSeed = header.fields[HeaderFields.MasterSeed].bytes; _logger.finer( diff --git a/lib/src/kdbx_header.dart b/lib/src/kdbx_header.dart index 01e652c..98d5f7d 100644 --- a/lib/src/kdbx_header.dart +++ b/lib/src/kdbx_header.dart @@ -524,6 +524,9 @@ class KdbxHeader { VarDictionary get readKdfParameters => VarDictionary.read( ReaderHelper(fields[HeaderFields.KdfParameters].bytes)); + int get v3KdfTransformRounds => + ReaderHelper.singleUint64(fields[HeaderFields.TransformRounds].bytes); + void writeKdfParameters(VarDictionary kdfParameters) => _setHeaderField(HeaderFields.KdfParameters, kdfParameters.write());