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
intKey bytes.
phrase
OctetStringThe phrase.
auth
IAuthenticationProviderThe authentication provider.
Properties
AuthenticationProvider
Corresponding IAuthenticationProvider.
public IAuthenticationProvider AuthenticationProvider { get; }
Property Value
EngineIds
Engine IDs.
public ICollection<OctetString>? EngineIds { get; set; }
Property Value
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
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
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
Methods
Decrypt(ISnmpData, SecurityParameters)
Decrypts the specified data.
public ISnmpData Decrypt(ISnmpData data, SecurityParameters parameters)
Parameters
data
ISnmpDataThe data.
parameters
SecurityParametersThe parameters.
Returns
Encrypt(ISnmpData, SecurityParameters)
Encrypts the specified scope.
public ISnmpData Encrypt(ISnmpData data, SecurityParameters parameters)
Parameters
data
ISnmpDataThe scope data.
parameters
SecurityParametersThe parameters.
Returns
PasswordToKey(byte[], byte[])
Passwords to key.
public byte[] PasswordToKey(byte[] secret, byte[] engineId)
Parameters
Returns
- byte[]