加密模块
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
一个 |
private_key_b64 |
str
采用 base64 编码的私钥。 |
certificate_b64 |
str
base64 编码的证书。 |
ca_certificate_b64 |
str
采用 Base64 编码的 CA 证书。 |
logger |
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 专业人士那里获得解答。