MCPcopy
hub / github.com/authlib/authlib / decrypt

Method decrypt

authlib/jose/rfc7518/jwe_encs.py:123–137  ·  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

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

Callers 1

unwrapMethod · 0.45

Calls 1

check_ivMethod · 0.80

Tested by

no test coverage detected