加密模組

TIPCommon.encryption.decrypt

TIPCommon.encryption.decrypt(enc_data: bytes, key: str)→ str

使用提供的金鑰解密資料。

參數

參數
enc_data bytes

要解密的資料。

key str

用於產生金鑰的密碼。

傳回

解密後的訊息。

傳回類型

str

TIPCommon.encryption.decrypt_email

TIPCommon.encryption.decrypt_email(smime_email_config: SmimeEmailConfig, logger: ScriptLogger)→ Message

檢查電子郵件是否經過加密或簽署,並解密或驗證郵件。

參數

參數
email email.message.Message

包含電子郵件和憑證詳細資料的 email.message.Message 物件。

private_key_b64 str

Base64 編碼的私密金鑰。

certificate_b64 str

Base64 編碼的憑證。

ca_certificate_b64 str

Base64 編碼的 CA 憑證。

logger ScriptLogger

ScriptLogger 執行個體。

傳回

Message 物件,其中包含已解密或驗證的訊息。

傳回類型

email.message.Message

TIPCommon.encryption.encrypt

TIPCommon.encryption.encrypt(data: str, key: str)→ bytes

使用提供的金鑰加密資料。

參數

參數
data str

要加密的 JSON 字串。

key str

用於產生金鑰的密碼。

傳回

加密郵件。

傳回類型

bytes

TIPCommon.encryption.get_private_key

TIPCommon.encryption.get_private_key(password: str)→ bytes

從密碼衍生私密金鑰。

參數

參數
password str

用來產生金鑰的密碼。

傳回

位元組字串。

傳回類型

bytes

還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。