Skip to content

Commit

Permalink
Fix for format change in Bitwarden Desktop v2022.8.0
Browse files Browse the repository at this point in the history
Code cleanup.

#17
  • Loading branch information
GurpreetKang committed Aug 9, 2022
1 parent c604c29 commit 5c36331
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions BitwardenDecrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,13 @@ def decryptBitwardenJSON(options):
organizationKeys = datafile['keys']['organizationKeys']['encrypted']

# Get/Decrypt All Organization Keys
for uuid in organizationKeys.items():
for uuid, value in organizationKeys.items():
# File Format >= Desktop 2022.8.0
if type(uuid[1]) is dict:
BitwardenSecrets['OrgSecrets'][uuid[0]] = decryptRSA(uuid[1]['key'], BitwardenSecrets['RSAPrivateKey'])
if type(value) is dict:
BitwardenSecrets['OrgSecrets'][uuid] = decryptRSA(value['key'], BitwardenSecrets['RSAPrivateKey'])
# File Format < Desktop 2022.8.0
elif type(uuid[1]) is str:
BitwardenSecrets['OrgSecrets'][uuid[0]] = decryptRSA(uuid[1], BitwardenSecrets['RSAPrivateKey'])
elif type(value) is str:
BitwardenSecrets['OrgSecrets'][uuid] = decryptRSA(value, BitwardenSecrets['RSAPrivateKey'])
else:
print(f"ERROR: Could Not Determine Organization Keys From File Format")

Expand Down

0 comments on commit 5c36331

Please sign in to comment.