Table of Contents

Class AESPrivacyProviderBase

Namespace
Lextm.SharpSnmpLib.Security
Assembly
SharpSnmpLib.dll

Privacy provider base for AES.

public abstract class AESPrivacyProviderBase : IPrivacyProvider
Inheritance
AESPrivacyProviderBase
Implements
Derived
Inherited Members
Extension Methods

Remarks

This is an experimental port from SNMP#NET project. As AES is not part of SNMP RFC, this class is provided as it is. If you want other AES providers, you can port them from SNMP#NET in a similar manner.

Constructors

AESPrivacyProviderBase(int, OctetString, IAuthenticationProvider)

Initializes a new instance of the AESPrivacyProviderBase class.

protected AESPrivacyProviderBase(int keyBytes, OctetString phrase, IAuthenticationProvider auth)

Parameters

keyBytes int

Key bytes.

phrase OctetString

The phrase.

auth IAuthenticationProvider

The authentication provider.

Properties

AuthenticationProvider

Corresponding IAuthenticationProvider.

public IAuthenticationProvider AuthenticationProvider { get; }

Property Value

IAuthenticationProvider

EngineIds

Engine IDs.

public ICollection<OctetString>? EngineIds { get; set; }

Property Value

ICollection<OctetString>

Remarks

This is an optional field, and only used by TRAP v2 authentication.

IsSupported

Verifies if the provider is supported.

public static bool IsSupported { get; }

Property Value

bool

KeyBytes

Gets the key bytes.

public int KeyBytes { get; }

Property Value

int

The key bytes.

MaximumKeyLength

Return maximum encryption/decryption key length. For DES, returned value is 16

DES protocol itself requires an 8 byte key. Additional 8 bytes are used for generating the encryption IV. For encryption itself, first 8 bytes of the key are used.

public int MaximumKeyLength { get; }

Property Value

int

Salt

Gets the salt.

public OctetString Salt { get; }

Property Value

OctetString

The salt.

UseLegacy

Flag to force using legacy encryption/decryption code on .NET 6.

public static bool UseLegacy { get; set; }

Property Value

bool

Methods

Decrypt(ISnmpData, SecurityParameters)

Decrypts the specified data.

public ISnmpData Decrypt(ISnmpData data, SecurityParameters parameters)

Parameters

data ISnmpData

The data.

parameters SecurityParameters

The parameters.

Returns

ISnmpData

Encrypt(ISnmpData, SecurityParameters)

Encrypts the specified scope.

public ISnmpData Encrypt(ISnmpData data, SecurityParameters parameters)

Parameters

data ISnmpData

The scope data.

parameters SecurityParameters

The parameters.

Returns

ISnmpData

PasswordToKey(byte[], byte[])

Passwords to key.

public byte[] PasswordToKey(byte[] secret, byte[] engineId)

Parameters

secret byte[]

The secret.

engineId byte[]

The engine identifier.

Returns

byte[]