C# Класс SnmpSharpNet.PrivacyAES

AES privacy protocol implementation class.
Наследование: IPrivacyProtocol
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
_keyBytes int
_salt System.Int64

Открытые методы

Метод Описание
Decrypt ( byte cryptedData, int offset, int length, byte key, int engineBoots, int engineTime, byte privacyParameters ) : byte[]

Decrypt ScopedPdu BER encoded byte array.

Encrypt ( byte unencryptedData, int offset, int length, byte key, int engineBoots, int engineTime, byte &privacyParameters, IAuthenticationDigest authDigest ) : byte[]

Encrypt ScopedPdu data BER encoded in a byte array.

ExtendShortKey ( byte shortKey, byte password, byte engineID, IAuthenticationDigest authProtocol ) : byte[]

Some protocols support a method to extend the encryption or decryption key when supplied key is too short.

GetEncryptedLength ( int scopedPduLength ) : int

Calculates and returns length of the buffer that is the result of the encryption method.

PasswordToKey ( byte secret, byte engineId, IAuthenticationDigest authProtocol ) : byte[]

Convert privacy password into encryption key using packet authentication hash.

PrivacyAES ( int keyBytes ) : System

Standard constructor.

Защищенные методы

Метод Описание
NextSalt ( ) : System.Int64

Get next salt Int64 value. Used internally to encrypt data.

Описание методов

Decrypt() публичный Метод

Decrypt ScopedPdu BER encoded byte array.
public Decrypt ( byte cryptedData, int offset, int length, byte key, int engineBoots, int engineTime, byte privacyParameters ) : byte[]
cryptedData byte Encrypted data byte array
offset int Offset within the buffer to start decryption process from
length int Length of data to decrypt
key byte Decryption key
engineBoots int Authoritative engine boots value. Retrieved as part of SNMP v3 discovery procedure
engineTime int Authoritative engine time value. Retrieved as part of SNMP v3 discovery procedure
privacyParameters byte Privacy parameters parsed from the incoming packet.
Результат byte[]

Encrypt() публичный Метод

Encrypt ScopedPdu data BER encoded in a byte array.
public Encrypt ( byte unencryptedData, int offset, int length, byte key, int engineBoots, int engineTime, byte &privacyParameters, IAuthenticationDigest authDigest ) : byte[]
unencryptedData byte BER encoded byte array that needs to be encrypted
offset int Offset within the BER encoded byte array to start encryption operation from.
length int Length of data to encrypt
key byte Encryption key
engineBoots int Authoritative engine boots value. Retrieved as part of SNMP v3 discovery process.
engineTime int Authoritative engine time value. Retrieved as part of SNMP v3 discovery process.
privacyParameters byte Byte array that will receive privacy parameters information that is the result of the /// encryption procedure.
authDigest IAuthenticationDigest Authentication digest reference. Not used by AES protocol and can be null
Результат byte[]

ExtendShortKey() публичный Метод

Some protocols support a method to extend the encryption or decryption key when supplied key is too short.
public ExtendShortKey ( byte shortKey, byte password, byte engineID, IAuthenticationDigest authProtocol ) : byte[]
shortKey byte Key that needs to be extended
password byte Privacy password as configured on the SNMP agent.
engineID byte Authoritative engine id. Value is retrieved as part of SNMP v3 discovery procedure
authProtocol IAuthenticationDigest Authentication protocol class instance cast as
Результат byte[]

GetEncryptedLength() публичный Метод

Calculates and returns length of the buffer that is the result of the encryption method.
public GetEncryptedLength ( int scopedPduLength ) : int
scopedPduLength int Length of the buffer that is needs to be encrypted.
Результат int

NextSalt() защищенный Метод

Get next salt Int64 value. Used internally to encrypt data.
protected NextSalt ( ) : System.Int64
Результат System.Int64

PasswordToKey() публичный Метод

Convert privacy password into encryption key using packet authentication hash.
Thrown when key size is shorter then MinimumKeyLength
public PasswordToKey ( byte secret, byte engineId, IAuthenticationDigest authProtocol ) : byte[]
secret byte Privacy user secret
engineId byte Authoritative engine id of the snmp agent
authProtocol IAuthenticationDigest Authentication protocol
Результат byte[]

PrivacyAES() публичный Метод

Standard constructor.
public PrivacyAES ( int keyBytes ) : System
keyBytes int Key size in bytes. Acceptable values are /// 16 = 128-bit key size, 24 = 192-bit key size, or 32 = 256-bit key size.
Результат System

Описание свойств

_keyBytes защищенное свойство

AES protocol key bytes. Valid values are 16 (for AES128), 24 (AES192) or 32 (AES256).
protected int _keyBytes
Результат int

_salt защищенное свойство

Salt value
protected Int64,System _salt
Результат System.Int64