Browse Source

removed logging, fixed null passwords.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
1a11057811
  1. 5
      lib/src/kdbx_format.dart
  2. 6
      lib/src/kdbx_header.dart

5
lib/src/kdbx_format.dart

@ -535,9 +535,7 @@ class KdbxFormat {
} }
final credentialHash = credentials.getHash(); final credentialHash = credentials.getHash();
_logger.finest('credentialHash: ${ByteUtils.toHexList(credentialHash)}');
final key = KeyEncrypterKdf(argon2).encrypt(credentialHash, kdfParameters); final key = KeyEncrypterKdf(argon2).encrypt(credentialHash, kdfParameters);
_logger.finest('key: ${ByteUtils.toHexList(key)}');
// final keyWithSeed = Uint8List(65); // final keyWithSeed = Uint8List(65);
// keyWithSeed.replaceRange(0, masterSeed.length, masterSeed); // keyWithSeed.replaceRange(0, masterSeed.length, masterSeed);
@ -574,6 +572,9 @@ class KdbxFormat {
.findAllElements('Value') .findAllElements('Value')
.where((el) => el.getAttribute('Protected')?.toLowerCase() == 'true')) { .where((el) => el.getAttribute('Protected')?.toLowerCase() == 'true')) {
final pw = gen.decryptBase64(el.text.trim()); final pw = gen.decryptBase64(el.text.trim());
if (pw == null) {
continue;
}
KdbxFile.protectedValues[el] = ProtectedValue.fromString(pw); KdbxFile.protectedValues[el] = ProtectedValue.fromString(pw);
} }

6
lib/src/kdbx_header.dart

@ -353,10 +353,10 @@ class KdbxHeader {
final headerId = reader.readUint8(); final headerId = reader.readUint8();
final int bodySize = final int bodySize =
versionMajor >= 4 ? reader.readUint32() : reader.readUint16(); versionMajor >= 4 ? reader.readUint32() : reader.readUint16();
_logger.fine('Reading header with id $headerId (size: $bodySize)}'); // _logger.fine('Reading header with id $headerId (size: $bodySize)}');
final bodyBytes = bodySize > 0 ? reader.readBytes(bodySize) : null; final bodyBytes = bodySize > 0 ? reader.readBytes(bodySize) : null;
_logger.finer( // _logger.finer(
'Read header ${fields[headerId]}: ${ByteUtils.toHexList(bodyBytes)}'); // 'Read header ${fields[headerId]}: ${ByteUtils.toHexList(bodyBytes)}');
if (headerId > 0) { if (headerId > 0) {
final TE field = fields[headerId]; final TE field = fields[headerId];
yield createField(field, bodyBytes); yield createField(field, bodyBytes);

Loading…
Cancel
Save