• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H15-Oct-2020-273106

src/H15-Oct-2020-445333

tests/H15-Oct-2020-171118

LICENSEH A D15-Oct-20201.5 KiB2622

MANIFEST.inH A D15-Oct-2020125 54

PKG-INFOH A D15-Oct-20204.3 KiB12384

README.rstH A D15-Oct-20202.7 KiB10062

setup.cfgH A D15-Oct-2020119 128

setup.pyH A D15-Oct-20201.6 KiB5346

README.rst

1pylibsrtp
2=========
3
4|rtd| |pypi-v| |pypi-pyversions| |pypi-l| |pypi-wheel| |tests| |codecov|
5
6.. |rtd| image:: https://readthedocs.org/projects/pylibsrtp/badge/?version=latest
7   :target: https://pylibsrtp.readthedocs.io/
8
9.. |pypi-v| image:: https://img.shields.io/pypi/v/pylibsrtp.svg
10    :target: https://pypi.python.org/pypi/pylibsrtp
11
12.. |pypi-pyversions| image:: https://img.shields.io/pypi/pyversions/pylibsrtp.svg
13    :target: https://pypi.python.org/pypi/pylibsrtp
14
15.. |pypi-l| image:: https://img.shields.io/pypi/l/pylibsrtp.svg
16    :target: https://pypi.python.org/pypi/pylibsrtp
17
18.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/pylibsrtp.svg
19    :target: https://pypi.python.org/pypi/pylibsrtp
20
21.. |tests| image:: https://github.com/aiortc/pylibsrtp/workflows/tests/badge.svg
22    :target: https://github.com/aiortc/pylibsrtp/actions
23
24.. |codecov| image:: https://img.shields.io/codecov/c/github/aiortc/pylibsrtp.svg
25    :target: https://codecov.io/gh/aiortc/pylibsrtp
26
27What is ``pylibsrtp``?
28----------------------
29
30``pylibsrtp`` is a Python wrapper around `libsrtp`_, making it possible to
31encrypt and decrypt Secure Real-time Transport Protocol (SRTP) packets from
32Python code.
33
34SRTP is a profile of the Real-time Transport Protocol (RTP) which provides
35confidentiality, message authentication, and replay protection. It is defined
36by `RFC 3711`_.
37
38You can install ``pylibsrtp`` with ``pip``:
39
40.. code-block:: console
41
42    $ pip install pylibsrtp
43
44To learn more about ``pylibsrtp`` please `read the documentation`_.
45
46.. _libsrtp: https://github.com/cisco/libsrtp
47
48.. _RFC 3711: https://tools.ietf.org/html/rfc3711
49
50.. _read the documentation: https://pylibsrtp.readthedocs.io/en/stable/
51
52Example
53-------
54
55.. code:: python
56
57    #!/usr/bin/env python
58
59    from pylibsrtp import Policy, Session
60
61    key = (b'\x00' * 30)
62    rtp = b'\x80\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + (b'\xd4' * 160)
63
64    # protect RTP
65    tx_policy = Policy(key=key, ssrc_type=Policy.SSRC_ANY_OUTBOUND)
66    tx_session = Session(policy=tx_policy)
67    srtp = tx_session.protect(rtp)
68
69    # unprotect RTP
70    rx_policy = Policy(key=key, ssrc_type=Policy.SSRC_ANY_INBOUND)
71    rx_session = Session(policy=rx_policy)
72    rtp2 = rx_session.unprotect(srtp)
73
74    # check roundtrip worked!
75    assert rtp2 == rtp
76
77Building pylibsrtp
78------------------
79
80If you wish to build pylibsrtp yourself, you will need libsrtp version 2.0 or better.
81
82On Debian/Ubuntu run:
83
84.. code-block:: console
85
86    $ apt install libsrtp2-dev
87
88On OS X run:
89
90.. code-block:: console
91
92    $ brew install srtp
93
94License
95-------
96
97``pylibsrtp`` is released under the `BSD license`_.
98
99.. _BSD license: https://pylibsrtp.readthedocs.io/en/stable/license.html
100