Skip to main content

Python wrapper around the libsrtp library

Project description

rtd pypi-v pypi-pyversions pypi-l pypi-wheel travis codecov

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.

On Debian/Ubuntu run:

$ apt install libsrtp2-dev

On OS X run:

$ brew install srtp

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.

Files for pylibsrtp, version 0.6.1
Filename, size File type Python version Upload date Hashes
Filename, size pylibsrtp-0.6.1-cp35-cp35m-macosx_10_6_intel.whl (55.2 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp35-cp35m-manylinux1_i686.whl (62.6 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp35-cp35m-manylinux1_x86_64.whl (64.9 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp35-cp35m-win32.whl (42.8 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp35-cp35m-win_amd64.whl (48.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp36-cp36m-macosx_10_6_intel.whl (55.2 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp36-cp36m-manylinux1_i686.whl (62.6 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp36-cp36m-manylinux1_x86_64.whl (64.9 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp36-cp36m-win32.whl (42.8 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp36-cp36m-win_amd64.whl (48.7 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp37-cp37m-macosx_10_6_intel.whl (55.2 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp37-cp37m-manylinux1_i686.whl (62.6 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp37-cp37m-manylinux1_x86_64.whl (64.9 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp37-cp37m-win32.whl (42.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1-cp37-cp37m-win_amd64.whl (48.7 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pylibsrtp-0.6.1.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page