ICryptographer

Defines a cryptography service.

Namespace:
KpokPatagon.Security.Cryptography
Type:
Interface
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
Yes

Properties

Options

Cryptography configuration options.

Signature:
public CryptographyOptions Options { get; }

Methods

CompareHash

Compares a plain text input with a computed hash.

Signature:
public Boolean CompareHash(plaintext, hashedtext)
Returns

true if the hash matches, otherwhise false.

Parameters
Name Type Summary
plaintext Byte[] The input to compare with the hash.
hashedtext Byte[] The hash value to compare the input value. to

CompareHash

Compares a plain text input with a computed hash.

Signature:
public Boolean CompareHash(provider, plaintext, hashedtext)
Returns

true if the hash matches, otherwhise false.

Parameters
Name Type Summary
provider IHashProvider The HashProvider used to compare.
plaintext Byte[] The input to compare with the hash.
hashedtext Byte[] The hash value to compare with the input value.

CompareHash

Compares a plain text input with a computed hash.

Signature:
public Boolean CompareHash(provider, plaintext, hashedtext)
Returns

true if the hash matches, otherwhise false.

Parameters
Name Type Summary
provider IHashProvider The HashProvider used to compare.
plaintext String The input to compare with the hash.
hashedtext String The hash value to compare with the input value.

CompareHash

Compares a plain text input with a computed hash.

Signature:
public Boolean CompareHash(plaintext, hashedtext)
Returns

true if the hash matches, otherwhise false.

Parameters
Name Type Summary
plaintext String The input to compare with the hash.
hashedtext String The hash value to compare with the input value.

ComputeHash

Compute the hash value of plain text.

Signature:
public Byte[] ComputeHash(plaintext)
Returns

The computed hash value.

Parameters
Name Type Summary
plaintext Byte[] The input to compute the hash for.

ComputeHash

Compute the hash value of plain text.

Signature:
public Byte[] ComputeHash(provider, plaintext)
Returns

The computed hash value.

Parameters
Name Type Summary
provider IHashProvider The HashProvider used to compute the hash.
plaintext Byte[] The input to compute the hash for.

ComputeHash

Computes the hash for the specified stream.

Signature:
public Byte[] ComputeHash(provider, stream)
Returns

A hash code for the specified stream.

Parameters
Name Type Summary
provider IHashProvider An IHashProvider.
stream Stream The stream to be hashed.

ComputeHash

Compute the hash value of plain text.

Signature:
public Byte[] ComputeHash(provider, plaintext)
Returns

The computed hash value.

Parameters
Name Type Summary
provider IHashProvider The HashProvider used to compute the hash.
plaintext String The input to compute the hash for.

ComputeHash

Computes the hash for the specified stream.

Signature:
public Byte[] ComputeHash(stream)
Returns

The computed hash value.

Parameters
Name Type Summary
stream Stream A Stream to compute it's hash.

ComputeHash

Computes the hash value of plain text.

Signature:
public Byte[] ComputeHash(plaintext)
Returns

The computed hash value.

Parameters
Name Type Summary
plaintext String The input to compute the hash for.

Decrypt

Decrypts a secret.

Signature:
public Byte[] Decrypt(ciphertext)
Parameters
Name Type Summary
ciphertext Byte[] The cipher text to decrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Decrypt

Decrypts a secret using a specified ISymmetricProvider.

Signature:
public Byte[] Decrypt(provider, ciphertext)
Parameters
Name Type Summary
provider ISymmetricProvider The symetric provider to use.
ciphertext Byte[] The cipher text to decrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Decrypt

Decrypts a ciphered stream using the specified ISymmetricProvider.

Signature:
public Void Decrypt(provider, source, destination)
Parameters
Name Type Summary
provider ISymmetricProvider The symmetric provider.
source Stream The source stream to decrypt.
destination Stream The destination stream where the plain text result should be written.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Decrypt

Decrypts a ciphered text using a specified ISymmetricProvider.

Signature:
public Byte[] Decrypt(provider, ciphertext)
Parameters
Name Type Summary
provider ISymmetricProvider The symmetric provider.
ciphertext String The cipher text to decrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Decrypt

Decrypts a ciphered stream.

Signature:
public Void Decrypt(source, destination)
Parameters
Name Type Summary
source Stream The source stream to decrypt.
destination Stream The destination stream where the plain text result should be written.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Decrypt

Decrypts a ciphered text.

Signature:
public Byte[] Decrypt(ciphertext)
Parameters
Name Type Summary
ciphertext String The cipher text to decrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

DecryptFromBase64String

Decrypts a base 64 encoded ciphered text.

Signature:
public String DecryptFromBase64String(cipheredtext)
Remarks

If cipheredtext is null or empty, null is returned.

Parameters
Name Type Summary
cipheredtext String Ciphered text to be decrypted.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts a secret.

Signature:
public Byte[] Encrypt(plaintext)
Parameters
Name Type Summary
plaintext Byte[] The input to encrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts a secret using a specified ISymmetricProvider.

Signature:
public Byte[] Encrypt(provider, plaintext)
Parameters
Name Type Summary
provider ISymmetricProvider The symmetric provider.
plaintext Byte[] The input to encrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts the secret in source into destination using the specified ISymmetricProvider.

Signature:
public Void Encrypt(provider, source, destination)
Parameters
Name Type Summary
provider ISymmetricProvider The symmetric provider.
source Stream The source stream to encrypt.
destination Stream The destination stream where the ciphered text should be written.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts a secret using a specified ISymmetricProvider.

Signature:
public Byte[] Encrypt(provider, plaintext)
Parameters
Name Type Summary
provider ISymmetricProvider The symmetric provider.
plaintext String The input to encrypt.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts the secret in source into destination.

Signature:
public Void Encrypt(source, destination)
Parameters
Name Type Summary
source Stream The source stream to encrypt.
destination Stream The destination stream where the cipher text should be written.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

Encrypt

Encrypts a secret.

Signature:
public Byte[] Encrypt(plaintext)
Parameters
Name Type Summary
plaintext String A secret to be encrypted.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.

EncryptToBase64String

Encrypts a secret and returns the encryption as a Base 64 string.

Signature:
public String EncryptToBase64String(plaintext)
Remarks

If plaintext is null or empty, null is returned.

Parameters
Name Type Summary
plaintext String A secret to be encrypted.
Exceptions
Type Summary
CryptographyException Thrown when an error occurs while transforming the data.