mirror of
https://github.com/malmeloo/FindMy.py.git
synced 2026-04-18 03:54:01 +02:00
Fix accessory key generation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Pure-python NIST P-224 Elliptic Curve cryptography. Used for some Apple algorithms."""
|
||||
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
from cryptography.hazmat.primitives.hashes import SHA1
|
||||
from cryptography.hazmat.primitives.kdf.x963kdf import X963KDF
|
||||
|
||||
ECPoint = tuple[float, float]
|
||||
@@ -71,7 +71,7 @@ P224_P = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001
|
||||
def x963_kdf(value: bytes, si: bytes, length: int) -> bytes:
|
||||
"""Single pass of X9.63 KDF with SHA1."""
|
||||
return X963KDF(
|
||||
algorithm=SHA1(), # noqa: S303
|
||||
algorithm=hashes.SHA256(),
|
||||
sharedinfo=si,
|
||||
length=length,
|
||||
).derive(value)
|
||||
@@ -86,7 +86,7 @@ def derive_ps_key(privkey: bytes, sk: bytes) -> bytes:
|
||||
"""
|
||||
Derive a primary or secondary key used by an accessory.
|
||||
|
||||
:param pubkey: Public key generated during pairing
|
||||
:param privkey: Private key generated during pairing
|
||||
:param sk: Current secret key for this time period.
|
||||
Use SKN to derive the primary key, SKS for secondary.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user