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-0.12.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distributions

pylibsrtp-0.12.0-cp39-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9+Windows x86-64

pylibsrtp-0.12.0-cp39-abi3-win32.whl (1.2 MB view details)

Uploaded CPython 3.9+Windows x86

pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_x86_64.whl (2.3 MB view details)

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

pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (2.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

pylibsrtp-0.12.0-cp39-abi3-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pylibsrtp-0.12.0-cp39-abi3-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pylibsrtp-0.12.0.tar.gz
Algorithm Hash digest
SHA256 f5c3c0fb6954e7bb74dc7e6398352740ca67327e6759a199fe852dbc7b84b8ac
MD5 d87ce047f6916b9f76898ba2df2ce9d9
BLAKE2b-256 54c8a59e61f5dd655f5f21033bd643dd31fe980a537ed6f373cdfb49d3a3bd32

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pylibsrtp-0.12.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 061ef1dbb5f08079ac6d7515b7e67ca48a3163e16e5b820beea6b01cb31d7e54
MD5 a08081daf9224098787eef9e326b79ed
BLAKE2b-256 9b263a20b638a3a3995368f856eeb10701dd6c0e9ace9fb6665eeb1b95ccce19

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-win32.whl.

File metadata

  • Download URL: pylibsrtp-0.12.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 cbc9bfbfb2597e993a1aa16b832ba16a9dd4647f70815421bb78484f8b50b924
MD5 239b6d308d6adb756449044bc38768d3
BLAKE2b-256 48d7f13fedce3b21d24f6f154d1dee7287464a34728dcb3b0c50f687dbad5765

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0a8421e9fe4d20ce48d439430e55149f12b1bca1b0436741972c362c49948c0a
MD5 9b66b1b616cca77eee6683235b5c10ed
BLAKE2b-256 67c22ed7a4a5c38b999fd34298f76b93d29f5ba8c06f85cfad3efd9468343715

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 ef03b4578577690f716fd023daed8914eee6de9a764fa128eda19a0e645cc032
MD5 7149cde09ccc9bd8440fc49b754a8870
BLAKE2b-256 ebc20fae6687a06fcde210a778148ec808af49e431c36fe9908503a695c35479

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 36d07de64dbc82dbbb99fd77f36c8e23d6730bdbcccf09701945690a9a9a422a
MD5 5d6d59130357c1c0899c9ff87e17ab79
BLAKE2b-256 397be1021d27900315c2c077ec7d45f50274cedbdde067ff679d44df06f01a8a

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33e3e223102989b71f07e1deeb804170ed53fb4e1b283762eb031bd45bb425d4
MD5 2c5b98ab223e9fe6605fdac48f6ae58e
BLAKE2b-256 d0fc0b1e1bfed420d79427d50aff84c370dcd78d81af9500c1e86fbcc5bf95e1

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b74aaf8fac1b119a3c762f54751c3d20e77227b84c26d85aae57c2c43129b49c
MD5 35d089bf6eb68ea01009353ac6b4d03c
BLAKE2b-256 6c3a4bdab9fc1d78f2efa02c8a8f3e9c187bfa278e89481b5123f07c8dd69310

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 242fa3d44219846bf1734d5df595563a2c8fbb0fb00ccc79ab0f569fc0af2c1b
MD5 dba4f29c300fc59141dde6b3a778edba
BLAKE2b-256 7fa22dd0188be58d3cba48c5eb4b3c787e5743c111cd0c9289de4b6f2798382a

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2c81d152606721331ece87c80ed17159ba6da55c7c61a6b750cff67ab7f63a5
MD5 3d85bac1be0ef4ddf0b012904a3211d9
BLAKE2b-256 051aee553abe4431b7bd9bab18f078c0ad2298b94ea55e664da6ecb8700b1052

See more details on using hashes here.

File details

Details for the file pylibsrtp-0.12.0-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pylibsrtp-0.12.0-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5adde3cf9a5feef561d0eb7ed99dedb30b9bf1ce9a0c1770b2bf19fd0b98bc9a
MD5 71a1643e2caf446af5394496e95a2da8
BLAKE2b-256 65f0b818395c4cae2d5cc5a0c78fc47d694eae78e6a0d678baeb52a381a26327

See more details on using hashes here.

Supported by

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