AirPlay.V2.Srp (AirPlay v0.1.0)

Copy Markdown View Source

SRP-6a client for AirPlay 2 transient pairing, byte-exact to the AirPlay 2 SRP-6a parameters.

Group: the 3072-bit RFC 5054 prime, g = 5, hash SHA-512. For transient pairing the username is "Pair-Setup" and the password is the fixed "3939".

s = Srp.session("Pair-Setup", "3939", device_public_b, salt)
# s.client_pk (A) and s.client_proof (M1) go in pair-setup #2 TLV;
# s.session_key (K, 64 bytes SHA-512) keys the ChaCha20-Poly1305 channel.

Summary

Functions

g()

The generator g.

n()

The group modulus N.

Run the SRP-6a client. username/password are binaries, server_b/salt the device's public value (B) and salt from pair-setup #1. Pass a: (client private, integer) to make it deterministic; otherwise a fresh 256-bit value is used.

Functions

g()

The generator g.

n()

The group modulus N.

session(username, password, server_b, salt, opts \\ [])

@spec session(binary(), binary(), binary(), binary(), keyword()) :: %{
  a: pos_integer(),
  client_pk: binary(),
  client_proof: binary(),
  session_key: binary()
}

Run the SRP-6a client. username/password are binaries, server_b/salt the device's public value (B) and salt from pair-setup #1. Pass a: (client private, integer) to make it deterministic; otherwise a fresh 256-bit value is used.