findmy.util.crypto

Pure-python NIST P-224 Elliptic Curve cryptography. Used for some Apple algorithms.

Attributes

P224_N

Functions

encrypt_password(→ bytes)

Encrypt password using PBKDF2-HMAC.

decrypt_spd_aes_cbc(→ bytes)

Decrypt SPD data using SRP session key.

x963_kdf(→ bytes)

Single pass of X9.63 KDF with SHA1.

bytes_to_int(→ int)

Convert bytes in big-endian format to int.

derive_ps_key(→ bytes)

Derive a primary or secondary key used by an accessory.

Module Contents

findmy.util.crypto.P224_N = 26959946667150639794667015087019625940457807714424391721682722368061
findmy.util.crypto.encrypt_password(password: str, salt: bytes, iterations: int, protocol: str) bytes

Encrypt password using PBKDF2-HMAC.

findmy.util.crypto.decrypt_spd_aes_cbc(session_key: bytes, data: bytes) bytes

Decrypt SPD data using SRP session key.

findmy.util.crypto.x963_kdf(value: bytes, si: bytes, length: int) bytes

Single pass of X9.63 KDF with SHA1.

findmy.util.crypto.bytes_to_int(value: bytes) int

Convert bytes in big-endian format to int.

findmy.util.crypto.derive_ps_key(privkey: bytes, sk: bytes) bytes

Derive a primary or secondary key used by an accessory.

Parameters:
  • privkey – Private key generated during pairing

  • sk – Current secret key for this time period. Use SKN to derive the primary key, SKS for secondary.