C# Класс P2PStateServer.SHA256_AESAuthenticator

Represents an authentication object that hashes data with he SHA256 hash algorithm and encrypts/decrypts data with the Rjindael algorithm
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
GetClientResponseDigest ( string Algorithm, string Username, string Realm, string Nonce, int NonceCount, string ClientNonce, string QOP, string URI ) : string

Calculate a Server Response Digest in Accordance to RFC 2617

GetNewChallenge ( ) : string

Generates a new random challenge

GetServerResponseDigest ( string Algorithm, string Username, string Realm, string Nonce, int NonceCount, string ClientNonce, string QOP, string URI ) : string

Calculate a Server Response Digest in Accordance to RFC 2617

GetSessionKey ( string Username, string Realm, string Nonce, string ClientNonce ) : byte[]

Calculates a session key from the supplied data

Protect ( byte Data, byte SessionKey ) : byte[]

Encrypts data using the AES algorithm

SHA256_AESAuthenticator ( string Password ) : System

Initializes a new instance of the SHA256_AESAuthenticator class

Unprotect ( byte Data, byte SessionKey, int Length ) : byte[]

Decrypts data using the AES algorithm

Приватные методы

Метод Описание
CalculateDigest ( string Username, string Realm, string Password, string Nonce, int NonceCount, string ClientNonce, string QOP, string Method, string URI, HashAlgorithm HashAlg ) : string

Calculate a Response Digest in Accordance to RFC 2617

Decrypt ( byte Data, SymmetricAlgorithm DecryptionObject, int UnEncryptedSize ) : byte[]

Decrypts data

EnHex ( byte data ) : string

Calculates a Hex string representation of data, in accordance to the 32LHEX format of the Authorization Request Header in RFC 2617

Encrypt ( byte Data, SymmetricAlgorithm EncryptionObject ) : byte[]

Encrypt data

GetHashAlgorithm ( ) : HashAlgorithm

Gets the HashAlgorithm object used by this Authenticator

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

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

Calculate a Server Response Digest in Accordance to RFC 2617
public GetClientResponseDigest ( string Algorithm, string Username, string Realm, string Nonce, int NonceCount, string ClientNonce, string QOP, string URI ) : string
Algorithm string The Algorithm name
Username string The Username
Realm string The Realm
Nonce string The Nonce
NonceCount int The Nonce count
ClientNonce string The Client nonce
QOP string QOP
URI string URI
Результат string

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

Generates a new random challenge
public GetNewChallenge ( ) : string
Результат string

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

Calculate a Server Response Digest in Accordance to RFC 2617
public GetServerResponseDigest ( string Algorithm, string Username, string Realm, string Nonce, int NonceCount, string ClientNonce, string QOP, string URI ) : string
Algorithm string The Algorithm name
Username string The Username
Realm string The Realm
Nonce string The Nonce
NonceCount int The Nonce count
ClientNonce string The Client nonce
QOP string QOP
URI string URI
Результат string

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

Calculates a session key from the supplied data
public GetSessionKey ( string Username, string Realm, string Nonce, string ClientNonce ) : byte[]
Username string The Username
Realm string The Realm
Nonce string The Nonce
ClientNonce string The ClientNonce
Результат byte[]

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

Encrypts data using the AES algorithm
public Protect ( byte Data, byte SessionKey ) : byte[]
Data byte Plaintext data
SessionKey byte The encryption session key
Результат byte[]

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

Initializes a new instance of the SHA256_AESAuthenticator class
public SHA256_AESAuthenticator ( string Password ) : System
Password string Secret password used for authentication and generating encryption keys
Результат System

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

Decrypts data using the AES algorithm
public Unprotect ( byte Data, byte SessionKey, int Length ) : byte[]
Data byte Encrypted Data
SessionKey byte Encrytion Session key
Length int Length of descrypted data
Результат byte[]