MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / decrypt

Function decrypt

web/pgadmin/utils/crypto.py:47–61  ·  view source on GitHub ↗

Decrypt the AES encrypted string. Parameters: ciphertext -- Encrypted string with AES method. key -- key to decrypt the encrypted string.

(ciphertext, key)

Source from the content-addressed store, hash-verified

45
46
47def decrypt(ciphertext, key):
48 """
49 Decrypt the AES encrypted string.
50
51 Parameters:
52 ciphertext -- Encrypted string with AES method.
53 key -- key to decrypt the encrypted string.
54 """
55
56 ciphertext = base64.b64decode(ciphertext)
57 iv = ciphertext[:iv_size]
58
59 cipher = Cipher(AES(pad(key)), CFB8(iv), default_backend())
60 decryptor = cipher.decryptor()
61 return decryptor.update(ciphertext[iv_size:]) + decryptor.finalize()
62
63
64def pad(key):

Callers 11

_password_checkFunction · 0.90
change_passwordMethod · 0.90
runTestMethod · 0.90
validate_master_passwordFunction · 0.90
_decode_passwordMethod · 0.90
_decrypt_passwordMethod · 0.90
cancel_transactionMethod · 0.90
export_password_envMethod · 0.90
create_ssh_tunnelMethod · 0.90

Calls 2

padFunction · 0.85
updateMethod · 0.45

Tested by 1

runTestMethod · 0.72