MCPcopy Create free account
hub / github.com/authlib/authlib / decrypt

Method decrypt

authlib/jose/rfc7518/jwe_encs.py:121–135  ·  view source on GitHub ↗

Key Decryption with AES GCM. :param ciphertext: ciphertext in bytes :param aad: additional authenticated data in bytes :param iv: initialization vector in bytes :param tag: authentication tag in bytes :param key: encrypted key in bytes :return: messag

(self, ciphertext, aad, iv, tag, key)

Source from the content-addressed store, hash-verified

119 return ciphertext, enc.tag
120
121 def decrypt(self, ciphertext, aad, iv, tag, key):
122 """Key Decryption with AES GCM.
123
124 :param ciphertext: ciphertext in bytes
125 :param aad: additional authenticated data in bytes
126 :param iv: initialization vector in bytes
127 :param tag: authentication tag in bytes
128 :param key: encrypted key in bytes
129 :return: message
130 """
131 self.check_iv(iv)
132 cipher = Cipher(AES(key), GCM(iv, tag), backend=default_backend())
133 d = cipher.decryptor()
134 d.authenticate_additional_data(aad)
135 return d.update(ciphertext) + d.finalize()
136
137
138JWE_ENC_ALGORITHMS = [

Callers 1

unwrapMethod · 0.45

Calls 1

check_ivMethod · 0.80

Tested by

no test coverage detected