Skip to content

Commit 8698fdc

Browse files
committed
Fix composite key computation for BytesIO
In case a keyfile as BytesIO has been read before, the next read will be empty. We need to ensure that we are reading the data from the beginning. Add seek to start to fix it.
1 parent e43ca6c commit 8698fdc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pykeepass/kdbx_parsing/common.py

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def compute_key_composite(password=None, keyfile=None):
128128
# hash the keyfile
129129
if keyfile:
130130
if hasattr(keyfile, "read"):
131+
keyfile.seek(0)
131132
keyfile_bytes = keyfile.read()
132133
else:
133134
with open(keyfile, 'rb') as f:

0 commit comments

Comments
 (0)