Library / SDK
cisco/libsrtp avatar
cisco/libsrtp

libSRTP for C applications securing RTP and RTCP streams

Library for SRTP (Secure Realtime Transport Protocol)

1,401 stars527 forksCNOASSERTION

At a glance

What is it?
libSRTP is a C library for encrypting and authenticating RTP and RTCP packets according to SRTP. It fits applications that already handle real-time media transport, but it implements SRTP rather than a complete signaling, media, or session-management stack.
Who is it for?
Application developers that already manage RTP sessions and need an SRTP packet-protection layer should evaluate libSRTP, especially when a native C dependency and a small protected packet API are acceptable. Projects needing signaling, media transport, DTLS-SRTP negotiation, or an unsupported optional SRTP feature should select a higher-level or alternative stack.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The RTP security gap addressed by libSRTP

RTP carries real-time data such as telephony audio and video, but the base protocol does not by itself provide SRTP's confidentiality and authentication properties. libSRTP targets that gap at the packet-processing layer. It can encrypt and authenticate RTP packets through `srtp_protect()`, producing protected SRTP packets, and decrypt SRTP packets while verifying their authentication through `srtp_unprotect()`. Separate functions apply corresponding protection to RTCP packets.

The intended users are C developers embedding secure real-time media into an application or service. A likely integration point is an existing RTP sender or receiver that already owns packet parsing, sockets, session state, and media timing. libSRTP is not presented as a replacement for RTP transport. It does not arrange calls, negotiate keys, select media codecs, send packets over a network, or manage a complete audio or video session. The README describes it as an implementation of SRTP, the Universal Security Transform, and a supporting cryptographic kernel.

That boundary matters when evaluating adoption. A communications application may need media transport, key agreement, session establishment, and SRTP policy together. libSRTP supplies the protection mechanism, while the surrounding application remains responsible for those adjacent functions. Its C API can be useful for a focused native integration, but it offers little direct value to a web application that relies on a browser media stack and has no requirement to process SRTP itself.

Inside libSRTP's stream and packet-processing model

The central abstraction is `srtp_stream_t`, an opaque state structure associated with one protected RTP and RTCP stream. According to the README, it contains the keys and parameters used by cipher and message-authentication functions, along with anti-replay data. The application receives this state through the library API but cannot depend on its internal layout. That separation limits direct coupling between application code and the implementation.

A session can contain several streams, with each stream associated with a particular sender. Each source uses a distinct stream context to protect its RTP and RTCP traffic. This design gives libSRTP per-stream cryptographic and replay state, rather than one undifferentiated packet-processing context for the entire session. Applications therefore need to route incoming protected traffic to the correct stream context.

The outbound data flow is conceptually narrow. An application supplies an RTP packet to `srtp_protect()`, which encrypts and authenticates it and returns an SRTP packet. The inbound path calls `srtp_unprotect()`, which decrypts the packet and verifies its authentication before returning RTP data. RTCP follows the same broad model through its corresponding functions. The cryptographic kernel performs much of the underlying work, although the README says that kernel is mostly undocumented because it operates behind the library API.

This packet-oriented design does not make key provisioning automatic. The README does not document a high-level key exchange, DTLS handshake, or session negotiation API. Integrators must consult `include/srtp.h`, which is identified as the authoritative SRTP API documentation, to determine the exact initialization, error, and cryptographic-policy interfaces.

Mandatory SRTP coverage and optional feature limits

The README states that libSRTP supports all mandatory SRTP features, but it does not claim complete support for every optional feature. This is the most important functional boundary to check before embedding it. RFC 3711 is identified as the SRTP standard, while RFC 3550 defines RTP. An application may assume an optional feature exists merely because it is part of the broader SRTP specification, so that assumption would be unsafe.

The protected object is also narrower than the entire communications problem. SRTP supplies confidentiality for RTP data and authentication for the RTP header and payload. libSRTP also protects RTCP with similar functions. It does not claim to secure the RTP session before cryptographic state has been established, and the README does not describe automatic negotiation of master keys, derivation policies, or cryptographic algorithms for a new call.

For packet routing, replay state is part of `srtp_stream_t`. That is useful because replay handling belongs with the protection context, but it also means stream-context selection is an application responsibility. Misrouting packets to the wrong stream can cause protection or unprotection to fail. A correct integration needs an explicit mapping between RTP and RTCP traffic and the contexts created for each sender.

The library is a poor fit when the required design relies on an SRTP optional feature absent from the supported set. It is also a poor fit for developers who need DTLS-SRTP negotiation, network transport, media mixing, or call control as part of one library. In those cases, the missing layer is substantial rather than a convenience API.

Building libSRTP and making the first API-level use

The repository layout shows several build paths rather than a single installation recipe. It contains `CMakeLists.txt`, `CMakePresets.json`, `configure`, `configure.ac`, `Makefile.in`, and `meson.build`. The README also has sections titled "Installing and Building libSRTP," "Changing Build Configuration," and "Using Visual Studio." However, the README does not show the actual commands, option names, installation destinations, or Visual Studio steps. Inventing an unconfirmed package-manager invocation or build flag would not be useful.

Based on the documented build systems, the first practical step is to obtain the source and use the exact instructions in the repository's build and configuration sections. After compilation, the README identifies the result as `libsrtp2.a`. A consuming C project must include the public SRTP interface from `include/srtp.h` and link against that compiled library. The README does not document the compiler command, linker command, pkg-config invocation, or platform-specific output directory, so no safe command example can be supplied here.

For the first real use, start at the packet API rather than the cryptographic kernel. Create and initialize the required library and stream contexts using the procedures in `include/srtp.h`, then pass outbound RTP data through `srtp_protect()`. On receipt, pass SRTP data through `srtp_unprotect()` and reject or otherwise handle packets that fail authentication. Configure corresponding RTCP protection paths. Because the README excerpt does not expose function signatures, context-creation names, return values, or error codes, those details must come from the header rather than inference.

A meaningful first integration check should cover one sender context, RTP and RTCP packets, and the mapping between a packet and its `srtp_stream_t`. The project also includes a `test/` directory and build workflows for CMake, Autotools, Meson, Coverity, and OSS-Fuzz, but the README does not provide instructions for running a particular test command.

libSRTP compared with application-managed SRTP

A real alternative is to implement the SRTP transform and its cryptographic policy directly inside an application or media framework. That approach can give the application direct control over packet processing, session state, supported algorithms, and platform-specific integration. It also transfers more security-sensitive responsibility to the developer, including authentication handling, anti-replay state, packet routing, and correct use of cryptographic primitives.

libSRTP takes a different approach. It exposes focused functions for protecting and unprotecting RTP and RTCP, while an opaque `srtp_stream_t` owns the stream keys, cryptographic parameters, and anti-replay data. The application manages session and transport concerns around that boundary. This is more focused than adopting a complete communications platform, but it is less self-contained than a stack that already negotiates and drives secure media sessions.

The choice therefore depends on scope. A native application that already receives or sends RTP packets and only needs the standardized packet transform can use libSRTP without taking on the entire SRTP implementation. A project that has no RTP infrastructure should not mistake libSRTP for that missing layer. A framework already containing SRTP may instead compare libSRTP against its existing packet pipeline, error model, and cryptographic configuration before adding another dependency.

Release cadence, upgrade work, and licence review

The repository is not archived. Its last push was on 2026-10-09, and the listed releases include v2.8.1 on 2026-09-21, v2.8.0 on 2026-03-14, and v2.7.0 on 2025-03-16. This indicates recent project activity based on the release history and push date, but it does not by itself establish the compatibility policy for a consuming application.

Upgrading a C library can require more than replacing an archive file. An integrator may need to review changes under `CHANGES`, inspect public declarations in `include/srtp.h`, rebuild against the configured cryptographic backend, and rerun the project's tests. The repository includes `CHANGES`, platform and build-system files, and multiple continuous-integration configurations. The README does not document semantic-versioning guarantees, API deprecation policy, migration recipes, or the exact upgrade procedure, so those points remain unconfirmed.

The licence is a custom BSD-style source and binary redistribution licence, which GitHub cannot classify. Source redistributions must retain the copyright notice, conditions, and disclaimer. Binary redistributions must reproduce those items in documentation or other distribution materials. The Cisco name and contributor names cannot be used for endorsement or promotion without prior written permission. The README also includes a broad warranty and liability disclaimer. This review describes the stated terms, not their legal effect; the authoritative `LICENSE` file should be checked for the actual release.

Editorial conclusion

Application developers that already manage RTP sessions and need an SRTP packet-protection layer should evaluate libSRTP, especially when a native C dependency and a small protected packet API are acceptable. Projects needing signaling, media transport, DTLS-SRTP negotiation, or an unsupported optional SRTP feature should select a higher-level or alternative stack. Before adoption, inspect the LICENSE file, confirm the required mandatory and optional SRTP features, build the project through one of its documented build systems, and verify that the cryptographic backend configuration matches the deployment environment.

Frequently asked questions

How do I install and build libSRTP on Linux?

The repository provides CMake, Autotools, and Meson build files, and the README contains sections for installation and build configuration. The README does not include the commands or option names needed to give a verified Linux tutorial.

Which API does libSRTP use to encrypt and authenticate RTP packets?

The documented outbound path is `srtp_protect()`, which encrypts and authenticates an RTP packet to produce an SRTP packet. The public API reference is located in `include/srtp.h`.

Does libSRTP provide all optional SRTP features?

No. The README says the library supports all mandatory SRTP features, but not all optional features. A prospective user must confirm that the required feature set is supported before adoption.

Official sources

  1. cisco/libsrtp on GitHub
  2. Issues
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/cisco-libsrtp.svg)](https://hysenlabs.com/projects/cisco-libsrtp)

Was this useful?