C# Class P2PStateServer.SHA256_AESAuthenticator

Represents an authentication object that hashes data with he SHA256 hash algorithm and encrypts/decrypts data with the Rjindael algorithm
ファイルを表示 Open project: tenor/p2pStateServer Class Usage Examples

Public Methods

Method Description
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

Private Methods

Method Description
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

Method Details

GetClientResponseDigest() public method

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
return string

GetNewChallenge() public method

Generates a new random challenge
public GetNewChallenge ( ) : string
return string

GetServerResponseDigest() public method

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
return string

GetSessionKey() public method

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
return byte[]

Protect() public method

Encrypts data using the AES algorithm
public Protect ( byte Data, byte SessionKey ) : byte[]
Data byte Plaintext data
SessionKey byte The encryption session key
return byte[]

SHA256_AESAuthenticator() public method

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
return System

Unprotect() public method

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
return byte[]