Table of Contents

Class EncryptorBlock

Namespace
VisioForge.Core.MediaBlocks.Special
Assembly
VisioForge.Core.dll

A specialized media block that encrypts media streams using AES encryption in real-time. This block processes unencrypted media data and outputs encrypted content, enabling secure media storage and transmission for content protection.

Key features:

  • AES encryption with configurable key sizes (128, 192, 256 bits)
  • Support for various AES modes (ECB, CBC, CFB, OFB, CTR, GCM)
  • Real-time stream encryption with minimal latency
  • Transparent passthrough design
  • Compatible with any media type (video, audio, data)
  • Configurable initialization vectors and padding

Common use cases:

  • Creating DRM-protected content for secure distribution
  • Encrypting media files before storage or transmission
  • Building secure streaming applications
  • Implementing custom content protection systems
  • Protecting sensitive video/audio recordings
  • Compliance with data protection regulations

Technical details:

  • Uses hardware-accelerated AES when available
  • Preserves stream timing and metadata
  • Zero-copy operation where possible
  • Thread-safe encryption processing
  • Compatible with standard AES implementations
  • Pairs with DecryptorBlock for round-trip encryption

Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class EncryptorBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

EncryptorBlock(EncryptorDecryptorSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.EncryptorBlock class with specified encryption settings.

public EncryptorBlock(EncryptorDecryptorSettings settings)

Parameters

settings EncryptorDecryptorSettings

The encryption configuration including AES key, mode, IV, and other parameters.

Properties

Input

Gets the input pad for receiving unencrypted media streams.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of input pads. This block has a single input for unencrypted data.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad that provides the encrypted media stream.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the array of output pads. This block has a single output for encrypted data.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the encryption settings including key, mode, and parameters. These settings define how the media will be encrypted.

public EncryptorDecryptorSettings Settings { get; set; }

Property Value

EncryptorDecryptorSettings

Type

Gets the media block type identifier for this encryptor.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the AES 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

true if the encryptor was successfully initialized; false if setup failed.

CleanUp()

Performs cleanup of the AES 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

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core GStreamer element wrapper for the AES encryptor.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement instance wrapping the AES encryptor element.

GetElement()

Gets the underlying GStreamer AES encryptor element.

public Element GetElement()

Returns

Element

The native GStreamer element performing AES encryption.

IsAvailable()

Determines whether the AES encryption functionality is available in the current environment. This checks if the required GStreamer AES encryption plugins are installed. The appropriate VisioForge SDK redistribution package must be included in your project.

public static bool IsAvailable()

Returns

bool

true if AES encryption is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this encryptor block. This internal method establishes the connection to the parent pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocksPipeline that contains this block.

See Also