API Reference¶
- class pylibsrtp.Error¶
Error that occurred making a libsrtp API call.
- class pylibsrtp.Policy(key: bytes | None = None, ssrc_type: int = 0, ssrc_value: int = 0, srtp_profile: int = 1)¶
Policy for single SRTP stream.
- SRTP_PROFILE_AEAD_AES_128_GCM = 7¶
AES-128 GCM mode
- SRTP_PROFILE_AEAD_AES_256_GCM = 8¶
AES-256 GCM mode
- SRTP_PROFILE_AES128_CM_SHA1_32 = 2¶
AES-128 CM mode with 32-bit authentication tag
- SRTP_PROFILE_AES128_CM_SHA1_80 = 1¶
AES-128 CM mode with 80-bit authentication tag (default)
- SSRC_ANY_INBOUND = 2¶
Indicates any inbound SSRC value
- SSRC_ANY_OUTBOUND = 3¶
Indicates any inbound SSRC value
- SSRC_SPECIFIC = 1¶
Indicates a specific SSRC value
- SSRC_UNDEFINED = 0¶
Indicates an undefined SSRC type
- property allow_repeat_tx: bool¶
Whether retransmissions of packets with the same sequence number are allowed.
- property key: bytes | None¶
The SRTP master key + master salt.
- property srtp_profile: int¶
The SRTP profile.
- property ssrc_type: int¶
The SSRC type.
- property ssrc_value: int¶
The SSRC value, if it is not a wildcard.
- property window_size: int¶
The window size to use for replay protection.
- class pylibsrtp.Session(policy: Policy | None = None)¶
SRTP session, which may comprise several streams.
If policy is not specified, streams should be added later using the
add_stream()
method.- add_stream(policy: Policy) None ¶
Add a stream to the SRTP session, applying the given policy to the stream.
- Parameters:
policy –
Policy
- protect(packet: bytes) bytes ¶
Apply SRTP protection to the RTP packet.
- Parameters:
packet –
bytes
- Return type:
bytes
- protect_rtcp(packet: bytes) bytes ¶
Apply SRTCP protection to the RTCP packet.
- Parameters:
packet –
bytes
- Return type:
bytes
- remove_stream(ssrc: int) None ¶
Remove the stream with the given ssrc from the SRTP session.
- Parameters:
ssrc –
int
- unprotect(packet: bytes) bytes ¶
Verify SRTP protection of the SRTP packet.
- Parameters:
packet –
bytes
- Return type:
bytes
- unprotect_rtcp(packet: bytes) bytes ¶
Verify SRTCP protection of the SRTCP packet.
- Parameters:
packet –
bytes
- Return type:
bytes