Class SRTPEncryptorBlock
- Namespace
- VisioForge.Core.MediaBlocks.Special
- Assembly
- VisioForge.Core.dll
A specialized media block that encrypts RTP streams using SRTP (Secure Real-time Transport Protocol) in real-time. This block processes unencrypted RTP packets and outputs SRTP encrypted packets, enabling secure media streaming and transmission for content protection.
Key features:
- SRTP encryption per RFC 3711 with configurable cipher suites
- Support for AES-128-ICM and AES-256-ICM encryption
- HMAC-SHA1 authentication with 80-bit or 32-bit tags
- Real-time RTP stream encryption with minimal latency
- Transparent passthrough design for RTP/RTCP packets
- Compatible with standard SRTP implementations
- Separate encryption contexts for RTP and RTCP
Common use cases:
- Securing VoIP and video conferencing streams
- Protecting real-time media broadcasts
- Building secure streaming applications with WebRTC
- Implementing SIP/RTP security (SIPS/SRTP)
- Compliance with security regulations for real-time communications
- Encrypting live video feeds and IP camera streams
Technical details:
- Uses AES encryption in Counter Mode (ICM/CTR) for low latency
- Provides message authentication and replay protection
- Preserves RTP timing and sequence numbers
- Zero-copy operation where possible
- Thread-safe encryption processing
- Compatible with standard SRTP key exchange mechanisms (SDES, DTLS-SRTP)
- Pairs with SRTPDecryptorBlock for round-trip encryption
Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class SRTPEncryptorBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
SRTPEncryptorBlock(SRTPSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.SRTPEncryptorBlock class with specified encryption settings.
public SRTPEncryptorBlock(SRTPSettings settings)Parameters
settingsSRTPSettings-
The SRTP encryption configuration including master key, cipher, and auth parameters.
Properties
Input
Gets the input pad for receiving unencrypted RTP streams.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the array of input pads. This block has a single input for unencrypted RTP data.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad that provides the encrypted SRTP stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the array of output pads. This block has a single output for encrypted SRTP data.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the SRTP encryption settings including key, cipher, and authentication method. These settings define how the RTP stream will be encrypted.
public SRTPSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for this SRTP encryptor.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the SRTP encryptor block within the media pipeline. Configures the encryption parameters and establishes pad connections. This method is called automatically during pipeline construction.
public override bool Build()Returns
- bool
-
trueif the encryptor was successfully initialized;falseif setup failed.
CleanUp()
Performs cleanup of the SRTP encryptor resources. Releases the GStreamer element and clears sensitive key material from memory.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core GStreamer element wrapper for the SRTP encryptor.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement instance wrapping the SRTP encryptor element.
GetElement()
Gets the underlying GStreamer SRTP encryptor element.
public Element GetElement()Returns
- Element
-
The native GStreamer element performing SRTP encryption.
IsAvailable()
Determines whether the SRTP encryption functionality is available in the current environment. This checks if the required GStreamer SRTP encryption plugins are installed. The appropriate VisioForge SDK redistribution package must be included in your project.
public static bool IsAvailable()Returns
- bool
-
trueif SRTP encryption is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this SRTP encryptor block. This internal method establishes the connection to the parent pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocksPipeline that contains this block.