File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,16 @@ def openssl_encrypt_aes256cbc_md5(plaintext: bytes, password: bytes) -> bytes:
4646 return b"Salted__" + salt + ciphertext
4747
4848
49+ def obfuscate_password (password : str ) -> str :
50+ """Obfuscate a password."""
51+ password_enc = openssl_encrypt_aes256cbc_md5 (
52+ plaintext = password .encode ("utf-8" ),
53+ password = SECRET_KEY ,
54+ )
55+
56+ return urllib .parse .quote (base64 .b64encode (password_enc ).decode ("utf-8" ), safe = "" )
57+
58+
4959async def async_fetch_remote_fingerprint (url : str ) -> str :
5060 """Retrieve the SHA-256 fingerprint of the remote server's TLS certificate.
5161
@@ -72,13 +82,3 @@ async def async_fetch_remote_fingerprint(url: str) -> str:
7282 finally :
7383 writer .close ()
7484 await writer .wait_closed ()
75-
76-
77- def obfuscate_password (password : str ) -> str :
78- """Obfuscate a password."""
79- password_enc = openssl_encrypt_aes256cbc_md5 (
80- plaintext = password .encode ("utf-8" ),
81- password = SECRET_KEY ,
82- )
83-
84- return urllib .parse .quote (base64 .b64encode (password_enc ).decode ("utf-8" ), safe = "" )
You can’t perform that action at this time.
0 commit comments