Miscallaneous tools

Miscellaneous Tools: Tools that are not common to symmetric or asymmetric.

pyflocker.ciphers.backends.cryptography_.misc.derive_hkdf_key(master_key: bytes, dklen: int, hashalgo: BaseHash, salt: bytes, cipher_ctx: bytes = b'enc-key', auth_ctx: bytes = b'auth-key') tuple[bytes, bytes][source]

Derive key materials for HMAC from given master key.

Parameters:
  • master_key – The key used to derive the keys from.

  • dklen – Desired lenth of the derived key.

  • hashalgo – The name of the hash algorithm.

  • salt – The salt to use.

  • cipher_ctx – Context for cipher.

  • auth_ctx – Context for HMAC.

Returns:

A pair of cipher key and MAC key.

pyflocker.ciphers.backends.cryptography_.misc.derive_poly1305_key(ckey: bytes, nonce: bytes) bytes[source]

Generate a poly1305 key.

Parameters:
  • ckey (bytes) – The key used for the cipher

  • nonce (bytes) – The nonce used for the cipher. It must be 12 bytes.

Returns:

A Poly1305 key.

Return type:

bytes

Raises:

ValueError – If the length of nonce is not equal to 8 or 12 bytes.