rtciv0.5.0

rtci-srtp

Sans-I/O SRTP and SRTCP (RFC 3711, RFC 7714 AES-GCM, RFC 9335 Cryptex) for WebRTC. 10 public modules, 37 items at 0.5.0.

README

SRTP and SRTCP for WebRTC: encryption and authentication of RTP and RTCP with the protection profiles DTLS-SRTP negotiates, replay protection, rollover counter tracking, key lifetimes and rekeying, Cryptex and encrypted header extensions.

Specifications

  • RFC 3711, SRTP and SRTCP
  • RFC 7714, AES-GCM for SRTP; RFC 6188, AES-192 and AES-256 counter mode
  • RFC 5764, keys from DTLS-SRTP
  • RFC 9335, completely encrypting RTP header extensions and contributing sources (Cryptex)
  • RFC 6904, encryption of header extensions

Clause-by-clause status, with the test that proves each clause: rfc3711, rfc7714, rfc6188, rfc9335, rfc6904.

Use

context::Context encrypts or decrypts one direction (encrypt_rtp / decrypt_rtp and the RTCP equivalents) for a protection_profile::ProtectionProfile. The root crate (rtci) creates the contexts from the keys rtci-dtls exports.

Sans-I/O

Packets in, packets out; the crate holds the per-stream replay and rollover state and nothing else. No I/O, no clock. All cryptography goes through rtci-crypto's provider (crypto-ring by default, or crypto-aws-lc-rs; openssl adds an OpenSSL AES-CTR cipher).

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_srtp

SRTP and SRTCP for the Sans-I/O WebRTC stack.

  • modconfigSession configuration: keys, protection profile, and replay-protection options.
  • modcontextThe encrypt/decrypt state for one SRTP/SRTCP session.
  • modcryptexCryptex ([RFC 9335]): encryption of the CSRCs and RTP header extensions.
  • modheader_extensionEncryption of selected RTP header extension elements ([RFC 6904]).
  • modkeyingMaster keys over a context's lifetime: the key derivation rate, the Master Key Identifier (MKI), the number of packets a master key may protect, and the events that tell the application to re-key ([RFC 3711] sections 3.2.1, 4.3.1, 8.1 and 9.2).
  • modoptionPer-context options, currently the replay-detector factory.
  • modprotection_profileThe DTLS-SRTP protection profiles and their key, salt and tag lengths.
  • usecrypto

rtci_srtp::config

Session configuration: keys, protection profile, and replay-protection options.

  • structConfigConfig is used to configure a session. The top-level integration exports keying material from DTLS and installs it here, or callers can directly pass the keys themselves. After a Config is passed to a session it must not be modified.
  • structSessionKeysSessionKeys bundles the keys required to setup an SRTP session
  • constLABEL_EXTRACTOR_DTLS_SRTPRFC 5764 exporter label used to derive SRTP master keys and salts from DTLS.

rtci_srtp::context

The encrypt/decrypt state for one SRTP/SRTCP session.

  • modsrtcpSRTCP protection and unprotection.
  • modsrtpSRTP protection and unprotection.
  • structContextContext represents a SRTP cryptographic context Context can only be used for one-way operations it must either used ONLY for encryption or ONLY for decryption
  • constMAX_MASTER_KEYSHow many master keys one context holds at a time (see Context::add_master_key).

rtci_srtp::context::srtcp

SRTCP protection and unprotection.

No public items at its top level.

rtci_srtp::context::srtp

SRTP protection and unprotection.

No public items at its top level.

rtci_srtp::cryptex

Cryptex ([RFC 9335]): encryption of the CSRCs and RTP header extensions.

  • structCryptexHow a Context uses Cryptex (RFC 9335).

rtci_srtp::header_extension

Encryption of selected RTP header extension elements ([RFC 6904]).

rtci_srtp::keying

Master keys over a context's lifetime: the key derivation rate, the Master Key Identifier (MKI), the number of packets a master key may protect, and the events that tell the application to re-key ([RFC 3711] sections 3.2.1, 4.3.1, 8.1 and 9.2).

  • structKeyDerivationRateThe key derivation rate (RFC 3711 section 4.3.1): session keys are derived again each time the packet index crosses a multiple of it. Zero, the default and what DTLS-SRTP fixes (RFC 5764 section 4.1.2), derives them once.
  • structKeyingHow a context is keyed beyond its first master key and salt; see Context::with_keying. Both are fixed for the context's lifetime (RFC 3711 sections 3.2.1 and 4.3.1).
  • structKeyLifetimeHow many packets one master key may protect before the context refuses to use it.
  • structKeyUsageHow much of a master key's lifetime is used; see Context::key_usage.
  • enumContextEventWhat a context reports to the application; read with Context::poll_event.
  • enumDiscardReasonWhy ContextEvent::PacketDiscarded discarded a packet (RFC 3711 section 3.3).
  • enumPacketKindWhich of a master key's two packet counts something is about.
  • fnvalidate_key_lifetimeChecks a key lifetime as Context::set_key_lifetime does: at least one packet, at most 2^48 SRTP and 2^31 SRTCP (RFC 3711 section 9.2).
  • constMAX_MKI_LENThe longest MKI a context accepts, in octets. RFC 3711 leaves the length to key management; DTLS-SRTP (RFC 5764 section 4.1.3) and SDES (RFC 4568) carry at most 255 and 128.
  • constMAX_PENDING_DISCARD_EVENTSThe most ContextEvent::PacketDiscarded events a context keeps queued.
  • constMAX_SRTCP_PACKETS_PER_KEYThe most SRTCP packets one master key may protect (RFC 3711 section 9.2, RFC 7714 section 10): 2^31.
  • constMAX_SRTP_PACKETS_PER_KEYThe most SRTP packets one master key may protect (RFC 3711 section 9.2, RFC 7714 section 10): 2^48.

rtci_srtp::option

Per-context options, currently the replay-detector factory.

rtci_srtp::protection_profile

The DTLS-SRTP protection profiles and their key, salt and tag lengths.

  • enumProtectionProfileProtectionProfile specifies Cipher and AuthTag details, similar to TLS cipher suite

Generated from the sources of rtci-srtp 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.