C# Class SnmpSharpNet.PrivacyAES

AES privacy protocol implementation class.
Inheritance: IPrivacyProtocol
Afficher le fichier Open project: griffina/SnmpSharpNet

Protected Properties

Свойство Type Description
_keyBytes int
_salt System.Int64

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
NextSalt ( ) : System.Int64

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

Method Details

Decrypt() public méthode

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.
Résultat byte[]

Encrypt() public méthode

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
Résultat byte[]

ExtendShortKey() public méthode

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
Résultat byte[]

GetEncryptedLength() public méthode

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.
Résultat int

NextSalt() protected méthode

Get next salt Int64 value. Used internally to encrypt data.
protected NextSalt ( ) : System.Int64
Résultat System.Int64

PasswordToKey() public méthode

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
Résultat byte[]

PrivacyAES() public méthode

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.
Résultat System

Property Details

_keyBytes protected_oe property

AES protocol key bytes. Valid values are 16 (for AES128), 24 (AES192) or 32 (AES256).
protected int _keyBytes
Résultat int

_salt protected_oe property

Salt value
protected Int64,System _salt
Résultat System.Int64