DTLS, SRTP and crypto providers
DTLS 1.2 and 1.3 secure every connection and export the SRTP keys; SRTP and SRTCP protect media. All cryptography goes through a pluggable provider, chosen per peer connection.
Crypto providers
All cryptography goes through a pluggable RTCCryptoProvider. Two built-in providers ship with the crate and the Cargo features are additive: enabling both builds, and ring is preferred when both are on.
# Default: the ring provider, no C toolchain required.
rtci = "0.5"
# aws-lc-rs instead (pulls in the aws-lc-sys C toolchain).
rtci = { version = "0.5", default-features = false, features = ["crypto-aws-lc-rs"] }
From README.md, “Crypto Providers” at v0.5.0.
There is no process-global provider to install. The provider is selected per peer connection through SettingEngine::set_crypto_provider (or SettingEngineBuilder::with_crypto_provider), so two peer connections in one process may use different ones.
Applications needing OpenSSL, a FIPS-validated module, an HSM or a platform backend can implement the public traits themselves and validate the result against the bundled conformance suite, rtci_crypto::conformance::assert_provider, behind the test-support feature of rtci-crypto:
#[test]
fn provider_conforms() {
let provider = MyProvider::new();
rtci_crypto::conformance::assert_provider(&provider);
}
From rtci-crypto/README.md, “rtci-crypto” at v0.5.0.
With neither backend enabled, applications construct their own Arc<dyn RTCCryptoProvider> and default_provider() returns CryptoError::NoDefaultProvider. rtci-crypto owns the primitives and opaque keyed state; DTLS, SRTP, STUN, certificate policy and wire-format composition remain in their protocol crates.
DTLS
rtci-dtls implements DTLS 1.2 (RFC 6347) and DTLS 1.3 (RFC 9147, no 0-RTT, no resumption across processes), use_srtp (RFC 5764) and the export of SRTP keying material, the extended master secret (RFC 7627), renegotiation indication (RFC 5746), connection identifiers for DTLS 1.2 (RFC 9146), session tickets (RFC 5077), and the certificate fingerprint rules of RFC 8122 and RFC 8827. Applications normally get DTLS from rtci, which configures it from the peer connection's certificates and fingerprints.
In the peer connection, renegotiation is refused (RFC 8827 section 6.5 forbids it in WebRTC, and DTLS 1.3 removed it). Certificates are RTCCertificates (peer_connection::certificate), given in the configuration with RTCConfigurationBuilder::with_certificates.
Interop cells at the release negotiate DTLS 1.2 with Pion and aiortc and DTLS 1.2 or 1.3 with str0m, in either role (Interoperability).
SRTP and SRTCP
rtci-srtp encrypts and authenticates RTP and RTCP with the protection profiles DTLS-SRTP negotiates: RFC 3711, AES-GCM (RFC 7714), AES-192 and AES-256 counter mode (RFC 6188), keys from DTLS-SRTP (RFC 5764), Cryptex (RFC 9335) and header extension encryption (RFC 6904), with replay protection, rollover counter tracking, key lifetimes and rekeying.
Whether Cryptex is negotiated follows the configuration's rtpHeaderEncryptionPolicy (W3C webrtc-extensions 10.2; default "negotiate"): RTCConfigurationBuilder::with_rtp_header_encryption_policy.
Key erasure
docs/key-erasure.md lists each piece of key material the DTLS and SRTP code holds, where it lives, and whether it is erased, per provider, with the test behind each answer. ring does not erase its own key objects; since 0.2 the ring provider keeps them in an allocation that is overwritten after the drop. The CI job key_residue searches dead stack frames for SRTP and DTLS keys in unoptimised and optimised builds. The document also states the limits: for example, ring's RSA key pair keeps its private limbs in heap allocations of ring's own, which the crate cannot reach, and the AWS-LC provider's HMAC states are not erased from the stack.
Security reports
Security problems are reported privately, as SECURITY.md describes.