XMediaLib.Srtp.Srtp_Crypto_Ctx (xmedialib v0.3.0)

Copy Markdown View Source

Per-SSRC SRTP cryptographic state (RFC 3711).

What problem this solves

Holds per-SSRC SRTP session keys and replay counters so encrypt/decrypt calls can advance ROC and SRTCP index safely across packets.

Holds derived session keys, replay/state indices, and algorithm choices. Updated in place by encrypt/2 and decrypt/2.

RFCs

Summary

Types

t()

@type t() :: %XMediaLib.Srtp.Srtp_Crypto_Ctx{
  aalg: atom(),
  ealg: atom(),
  f8_cipher: term(),
  k_a: binary(),
  k_a_rtcp: binary(),
  k_e: binary(),
  k_e_rtcp: binary(),
  k_s: binary(),
  k_s_rtcp: binary(),
  key_deriv_rate: non_neg_integer(),
  roc: non_neg_integer(),
  rtcp_idx: non_neg_integer(),
  s_l: non_neg_integer(),
  ssrc: non_neg_integer() | nil,
  tag_length: non_neg_integer()
}

Fields

  • :ssrc - synchronization source this context protects
  • :roc - rollover counter for RTP index (high 32 bits of packet index)
  • :s_l - highest received RTP sequence number seen
  • :rtcp_idx - SRTCP packet index for RTCP encryption
  • :key_deriv_rate - master key update rate (0 disables periodic re-key)
  • :ealg - encryption :null, :aes_cm, or unsupported :aes_f8 / TWICE
  • :aalg - authentication :null, :hmac_sha1, or :skein_hmac
  • :k_a, :k_e, :k_s - RTP auth, encryption, and salt session keys
  • :k_a_rtcp, :k_e_rtcp, :k_s_rtcp - SRTCP session keys (labels 0x03-0x05)
  • :tag_length - authentication tag size in octets (10 for WebRTC)