Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Sphyrnidae.Common.Encryption.EncryptionDispatcher Class Reference

Encrypts or decrypts a string. More...

Inheritance diagram for Sphyrnidae.Common.Encryption.EncryptionDispatcher:
Sphyrnidae.Common.Encryption.IEncryption

Public Member Functions

 EncryptionDispatcher (IEncryptionAlgorithms algorithms)
 
byte[] Hash (string str, string salt)
 Performs hashing (1-way encryption) against the string using the given salt More...
 
bool HashMatch (string str, string salt, byte[] hash)
 Determines if the hashed string is the same as what was provided (eg. passwords match) More...
 
string Encrypt (string str)
 Encrypts the given string More...
 
DecryptionResponse Decrypt (string str)
 Decrypts the given string More...
 

Protected Member Functions

EncryptionAlgorithm FindAlgorithm (string str)
 

Static Protected Member Functions

static string AddIdentifier (EncryptionAlgorithm algorithm, string str)
 
static string RemoveIdentifier (EncryptionAlgorithm algorithm, string str)
 

Properties

IEncryptionAlgorithms Algorithms [get]
 
EncryptionAlgorithm CurrentAlgorithm [get]
 

Detailed Description

Encrypts or decrypts a string.

Note that this class doesn't actually perform encryption activities. It instead passes it off to the correct handler to do the encryption/decryption.

Constructor & Destructor Documentation

◆ EncryptionDispatcher()

Sphyrnidae.Common.Encryption.EncryptionDispatcher.EncryptionDispatcher ( IEncryptionAlgorithms  algorithms)

Member Function Documentation

◆ AddIdentifier()

static string Sphyrnidae.Common.Encryption.EncryptionDispatcher.AddIdentifier ( EncryptionAlgorithm  algorithm,
string  str 
)
staticprotected

◆ Decrypt()

DecryptionResponse Sphyrnidae.Common.Encryption.EncryptionDispatcher.Decrypt ( string  str)

Decrypts the given string

Parameters
strThe string to decrypt

Note that decryption failures may throw an exception, or just return null value

Returns
A response object containing the decrypted value, and if the encrypted value is "current" - eg. if there is a new method/key

Implements Sphyrnidae.Common.Encryption.IEncryption.

◆ Encrypt()

string Sphyrnidae.Common.Encryption.EncryptionDispatcher.Encrypt ( string  str)

Encrypts the given string

Parameters
strThe string to encrypt

Note that encryption failures may throw an exception, or just return null

Returns
The encrypted string

Implements Sphyrnidae.Common.Encryption.IEncryption.

◆ FindAlgorithm()

EncryptionAlgorithm Sphyrnidae.Common.Encryption.EncryptionDispatcher.FindAlgorithm ( string  str)
protected

◆ Hash()

byte [] Sphyrnidae.Common.Encryption.EncryptionDispatcher.Hash ( string  str,
string  salt 
)

Performs hashing (1-way encryption) against the string using the given salt

Parameters
strThe string to 1-way encrypt
saltA non-private/secure string used in the encryption process
Returns
The hashed bytes

Implements Sphyrnidae.Common.Encryption.IEncryption.

◆ HashMatch()

bool Sphyrnidae.Common.Encryption.EncryptionDispatcher.HashMatch ( string  str,
string  salt,
byte[]  hash 
)

Determines if the hashed string is the same as what was provided (eg. passwords match)

Parameters
strThe string to hash
saltThe hashing salt
hashThe hash to compare
Returns
True if the hashed string matches

Implements Sphyrnidae.Common.Encryption.IEncryption.

◆ RemoveIdentifier()

static string Sphyrnidae.Common.Encryption.EncryptionDispatcher.RemoveIdentifier ( EncryptionAlgorithm  algorithm,
string  str 
)
staticprotected

Property Documentation

◆ Algorithms

IEncryptionAlgorithms Sphyrnidae.Common.Encryption.EncryptionDispatcher.Algorithms
getprotected

◆ CurrentAlgorithm

EncryptionAlgorithm Sphyrnidae.Common.Encryption.EncryptionDispatcher.CurrentAlgorithm
getprotected

The documentation for this class was generated from the following file: