Skip to content

Commit 51a5b1c

Browse files
committed
Move async_fetch_remote_fingerprint to the end
1 parent 1b073d0 commit 51a5b1c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

nanokvm/utils.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff 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+
4959
async 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="")

0 commit comments

Comments
 (0)