mrzhao520
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
import base64

def decrypt(nonce, ciphertext, associated_data):
    key = "Your32Apiv3Key"

    key_bytes = str.encode(key)
    nonce_bytes = str.encode(nonce)
    ad_bytes = str.encode(associated_data)
    data = base64.b64decode(ciphertext)

    aesgcm = AESGCM(key_bytes)
    return aesgcm.decrypt(nonce_bytes, data, ad_bytes)

分类:

技术点:

相关文章:

  • 2021-07-16
  • 2021-12-15
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-07-12
猜你喜欢
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-09-26
  • 2021-12-20
相关资源
相似解决方案