Skip to main content

Python wrapper around the libsrtp library

Project description

License Version Python versions Tests Coverage Documentation

What is pylibsrtp?

pylibsrtp is a Python wrapper around libsrtp, making it possible to encrypt and decrypt Secure Real-time Transport Protocol (SRTP) packets from Python code.

SRTP is a profile of the Real-time Transport Protocol (RTP) which provides confidentiality, message authentication, and replay protection. It is defined by RFC 3711.

You can install pylibsrtp with pip:

$ pip install pylibsrtp

To learn more about pylibsrtp please read the documentation.

Example

#!/usr/bin/env python

from pylibsrtp import Policy, Session

key = (b'\x00' * 30)
rtp = b'\x80\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + (b'\xd4' * 160)

# protect RTP
tx_policy = Policy(key=key, ssrc_type=Policy.SSRC_ANY_OUTBOUND)
tx_session = Session(policy=tx_policy)
srtp = tx_session.protect(rtp)

# unprotect RTP
rx_policy = Policy(key=key, ssrc_type=Policy.SSRC_ANY_INBOUND)
rx_session = Session(policy=rx_policy)
rtp2 = rx_session.unprotect(srtp)

# check roundtrip worked!
assert rtp2 == rtp

Building pylibsrtp

If you wish to build pylibsrtp yourself, you will need libsrtp version 2.0 or better.

Linux

On Debian/Ubuntu run:

$ apt install libsrtp2-dev

On Fedora/CentOS run:

$ dnf install libsrtp-devel

macOS

On macOS run:

$ brew install srtp

You will need to set some environment variables to link against libsrtp:

export CFLAGS=-I$(brew --prefix openssl)/include -I$(brew --prefix srtp)/include
export LDFLAGS=-L$(brew --prefix openssl)/lib -L$(brew --prefix srtp)/lib

License

pylibsrtp is released under the BSD license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylibsrtp-1.0.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pylibsrtp-1.0.0-cp310-abi3-win_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10+Windows ARM64

pylibsrtp-1.0.0-cp310-abi3-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10+Windows x86-64

pylibsrtp-1.0.0-cp310-abi3-win32.whl (1.2 MB view details)

Uploaded CPython 3.10+Windows x86

pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_i686.whl (2.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

pylibsrtp-1.0.0-cp310-abi3-manylinux_2_28_i686.whl (2.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ i686

pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.26+ x86-64manylinux: glibc 2.28+ x86-64

pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pylibsrtp-1.0.0-cp310-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

pylibsrtp-1.0.0-cp310-abi3-macosx_10_9_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file pylibsrtp-1.0.0.tar.gz.

File metadata

  • Download URL: pylibsrtp-1.0.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylibsrtp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b39dff075b263a8ded5377f2490c60d2af452c9f06c4d061c7a2b640612b34d4
MD5 a826363568a9d92083b3897d3655f2ae
BLAKE2b-256 0da66e532bec974aaecbf9fe4e12538489fb1c28456e65088a50f305aeab9f89

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: pylibsrtp-1.0.0-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 2696bdb2180d53ac55d0eb7b58048a2aa30cd4836dd2ca683669889137a94d2a
MD5 a0a52026b47da064736d761a73439f36
BLAKE2b-256 8eec6e02b2561d056ea5b33046e3cad21238e6a9097b97d6ccc0fbe52b50c858

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: pylibsrtp-1.0.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8d6527c4a78a39a8d397f8862a8b7cdad4701ee866faf9de4ab8c70be61fd34d
MD5 7743033aa168444767a75750aad144e3
BLAKE2b-256 c37043db21af194580aba2d9a6d4c7bd8c1a6e887fa52cd810b88f89096ecad2

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-win32.whl.

File metadata

  • Download URL: pylibsrtp-1.0.0-cp310-abi3-win32.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 bae377c3b402b17b9bbfbfe2534c2edba17aa13bea4c64ce440caacbe0858b55
MD5 4acdc25456e18aef4b349e4e68f11b46
BLAKE2b-256 1e512e9b34f484cbdd3bac999bf1f48b696d7389433e900639089e8fc4e0da0d

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c134fa09e7b80a5b7fed626230c5bc257fd771bd6978e754343e7a61d96bc7e6
MD5 7cac1b12a530199eb2903fe01f7cf2b6
BLAKE2b-256 e35652fa74294254e1f53a4ff170ee2006e57886cf4bb3db46a02b4f09e1d99f

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 f02e616c9dfab2b03b32d8cc7b748f9d91814c0211086f987629a60f05f6e2cc
MD5 5f36933d758b40ff92186c8240aabcb5
BLAKE2b-256 91e3715a453bfee3bea92a243888ad359094a7727cc6d393f21281320fe7798c

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4ddb562e443cf2e557ea2dfaeef0d7e6b90e96dd38eb079b4ab2c8e34a79f50b
MD5 b04a926d8b75e333313badc846a681c1
BLAKE2b-256 8ed5130c2b5b4b51df5631684069c6f0a6761c59d096a33d21503ac207cf0e47

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 81fb8879c2e522021a7cbd3f4bda1b37c192e1af939dfda3ff95b4723b329663
MD5 dfb9f7f0f7b2964187c3334146188be8
BLAKE2b-256 bd08a3f6e86c04562f7dce6717cd2206a0f84ca85c5e38121d998e0e330194c3

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 293c9f2ac21a2bd689c477603a1aa235d85cf252160e6715f0101e42a43cbedc
MD5 e84b5281b067e153f083ce073cec67bb
BLAKE2b-256 0e14cf5d2a98a66fdfe258f6b036cda570f704a644fa861d7883a34bc359501e

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9209b86e662ebbd17c8a9e8549ba57eca92a3e87fb5ba8c0e27b8c43cd08a767
MD5 0812d00687ef1ec4b5351462e76569c1
BLAKE2b-256 573f76a841978877ae13eac0d4af412c13bbd5d83b3df2c1f5f2175f2e0f68e5

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aaad74e5c8cbc1c32056c3767fea494c1e62b3aea2c908eda2a1051389fdad76
MD5 829bb98f31ceb420bd61a937fd9cd332
BLAKE2b-256 8d0e8d215484a9877adcf2459a8b28165fc89668b034565277fd55d666edd247

See more details on using hashes here.

File details

Details for the file pylibsrtp-1.0.0-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-1.0.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 822c30ea9e759b333dc1f56ceac778707c51546e97eb874de98d7d378c000122
MD5 6f7217dd6a6c535da20ac22b13f5957d
BLAKE2b-256 aaaf89e61a62fa3567f1b7883feb4d19e19564066c2fcd41c37e08d317b51881

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page