MCPcopy
hub / github.com/authlib/authlib / _hmac

Method _hmac

authlib/jose/rfc7518/jwe_encs.py:43–47  ·  view source on GitHub ↗
(self, ciphertext, aad, iv, key)

Source from the content-addressed store, hash-verified

41 self.hash_alg = getattr(hashlib, f"sha{hash_type}")
42
43 def _hmac(self, ciphertext, aad, iv, key):
44 al = encode_int(len(aad) * 8, 64)
45 msg = aad + iv + ciphertext + al
46 d = hmac.new(key, msg, self.hash_alg).digest()
47 return d[: self.key_len]
48
49 def encrypt(self, msg, aad, iv, key):
50 """Key Encryption with AES_CBC_HMAC_SHA2.

Callers 2

encryptMethod · 0.95
decryptMethod · 0.95

Calls 1

encode_intFunction · 0.85

Tested by

no test coverage detected