Skip to content

Commit 7c0aafe

Browse files
committed
fix transformed_key opening for kdbx3
1 parent f06236c commit 7c0aafe

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

pykeepass/kdbx_parsing/kdbx3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def compute_transformed(context):
2727
"""Compute transformed key for opening database"""
2828

2929
if context._._.transformed_key is not None:
30-
transformed_key = context._._transformed_key
30+
transformed_key = context._._.transformed_key
3131
else:
3232
key_composite = compute_key_composite(
3333
password=context._._.password,

tests/tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ def test_open_save(self):
775775
'test4_chacha20.kdbx', # KDBX v4 ChaCha test
776776
'test4_twofish.kdbx', # KDBX v4 Twofish test
777777
'test4_hex.kdbx', # legacy 64 byte hexadecimal keyfile test
778+
'test3.kdbx', # KDBX v3 transformed_key open test
778779
'test4_hex.kdbx', # KDBX v4 transformed_key open test
779780
]
780781
passwords = [
@@ -786,6 +787,7 @@ def test_open_save(self):
786787
'password',
787788
'password',
788789
None,
790+
None,
789791
]
790792
transformed_keys = [
791793
None,
@@ -795,7 +797,8 @@ def test_open_save(self):
795797
None,
796798
None,
797799
None,
798-
b'M\xb7\x08\xf6\xa7\xd1v\xb1{&\x06\x8f\xae\xe9\r\xeb\x9a\x1b\x02b\xce\xf2\x8aR\xaea)7\x1fs\xe9\xc0'
800+
b'5\x99y\xb6\x1e\x9e\x16\xfe`V\xd4\xe8\x12De\xd9[\xdd\xe2\x98\x1a\xa9\xfc-\xc4>\xd2\xc0\xc6(\xec\x0c',
801+
b'M\xb7\x08\xf6\xa7\xd1v\xb1{&\x06\x8f\xae\xe9\r\xeb\x9a\x1b\x02b\xce\xf2\x8aR\xaea)7\x1fs\xe9\xc0',
799802
]
800803
keyfiles = [
801804
'test3.key',
@@ -806,6 +809,7 @@ def test_open_save(self):
806809
'test4.key',
807810
'test4_hex.key',
808811
None,
812+
None,
809813
]
810814
encryption_algorithms = [
811815
'aes256',
@@ -815,6 +819,7 @@ def test_open_save(self):
815819
'chacha20',
816820
'twofish',
817821
'chacha20',
822+
'aes256',
818823
'chacha20',
819824
]
820825
kdf_algorithms = [
@@ -825,6 +830,7 @@ def test_open_save(self):
825830
'argon2',
826831
'argon2',
827832
'argon2',
833+
'aeskdf',
828834
'argon2',
829835
]
830836
versions = [
@@ -835,6 +841,7 @@ def test_open_save(self):
835841
(4, 0),
836842
(4, 0),
837843
(4, 0),
844+
(3, 1),
838845
(4, 0),
839846
]
840847

0 commit comments

Comments
 (0)