A wrapper to present a cryptography api but use the pycryptodome module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
457 B

  1. from Crypto.Protocol.KDF import HKDF as baseHKDF
  2. # https://www.pycryptodome.org/src/protocol/kdf#hkdf
  3. # https://cryptography.io/en/latest/hazmat/primitives/key-derivation-functions/#hkdf
  4. class HKDF:
  5. def __init__(self, algorithm, length, salt, info, backend=None):
  6. self._algo = algorithm
  7. self._len = length
  8. self._salt = salt
  9. self._info = info
  10. def derive(self, key):
  11. return baseHKDF(key, self._len, self._salt, self._algo, context=self._info)