Table of Contents

Class HapSession

Namespace
AppleTvControlLibrary.Mrp.AirPlay.Auth
Assembly
AppleTvControlLibrary.Mrp.dll

Manages cryptography for a HAP session according to IP in the HomeKit Accessory Protocol specification: data is encrypted/decrypted in blocks of 1024 bytes. Transparent (passthrough) until encryption is enabled.

public sealed class HapSession
Inheritance
HapSession
Inherited Members

Properties

IsEnabled

Gets a value indicating whether encryption has been enabled.

public bool IsEnabled { get; }

Property Value

bool

Methods

Decrypt(byte[])

Decrypt incoming data, accumulating partial blocks across calls.

public byte[] Decrypt(byte[] data)

Parameters

data byte[]

The bytes just received from the transport.

Returns

byte[]

Any decrypted plaintext produced by fully-received blocks so far; may be empty.

Enable(byte[], byte[])

Enable encryption with the specified keys.

public void Enable(byte[] outputKey, byte[] inputKey)

Parameters

outputKey byte[]

The key used to encrypt outgoing data.

inputKey byte[]

The key used to decrypt incoming data.

Encrypt(byte[])

Encrypt outgoing data, splitting it into 1024-byte frames.

public byte[] Encrypt(byte[] data)

Parameters

data byte[]

The plaintext to encrypt.

Returns

byte[]

The framed, encrypted bytes ready to write to the transport.