Table of Contents

Class Crypto

Namespace
Dynamicweb.Security.SystemTools
Assembly
Dynamicweb.Core.dll

This class contains functions uses to Encrypt/Decrypt source.

public class Crypto : IDisposable
Inheritance
Crypto
Implements
Inherited Members

Remarks

Crypto is a wrapper of System.Security.Cryptography.SymmetricAlgorithm classes and simplifies the interface. It supports customized SymmetricAlgorithm as well.

Constructors

Crypto(SymmProvEnum)

Determines kind of CryptoServiceProvider algorithm.

public Crypto(SymmProvEnum netSelected)

Parameters

netSelected SymmProvEnum

Enum of kinds.

Remarks

Constructor for using an intrinsic .Net SymmetricAlgorithm class.

Crypto(SymmetricAlgorithm)

Determines custom CryptoServiceProvider algorithm.

public Crypto(SymmetricAlgorithm serviceProvider)

Parameters

serviceProvider SymmetricAlgorithm

Remarks

Constructor for using a customized SymmetricAlgorithm class.

Fields

CryptoKey

public const string CryptoKey = "s5M1f3s8"

Field Value

string

disposed

protected bool disposed

Field Value

bool

Methods

Decrypt(string)

Decrypts the specified value.For new scenarios use AES

public static string Decrypt(string value)

Parameters

value string

The value.

Returns

string

Decrypt(string, string)

Decrypts an input source using current Key parameter.

public string Decrypt(string source, string key)

Parameters

source string

Source to encrypt.

key string

The current Key parameter.

Returns

string

String representation of the decrypted source.

DecryptAes(string)

Decrypts the specified value with AES.

public static string DecryptAes(string value)

Parameters

value string

The value.

Returns

string

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Encrypt(string)

Encrypts the specified value. For new scenarios use AES

public static string Encrypt(string value)

Parameters

value string

The value.

Returns

string

Encrypt(string, string)

Encrypts an input source using current Key parameter.

public string Encrypt(string source, string key)

Parameters

source string

Source to encrypt.

key string

The current Key parameter.

Returns

string

Encrypted source converted into Base64 so that the result can be used in xml.

EncryptAes(string)

Encrypts the specified value with AES.

public static string EncryptAes(string value)

Parameters

value string

The value.

Returns

string

EncryptPassword(string, UserPasswordHashAlgorithm)

Encrypts a string with either MD5 or SHA512 encryption according to global settings.

public static string EncryptPassword(string password, UserPasswordHashAlgorithm hashAlgorithm)

Parameters

password string

The password.

hashAlgorithm UserPasswordHashAlgorithm

The hash algorithm - either SHA512 or MD5 (default).

Returns

string

The password hashed with MD5 (default) or SHA512

Remarks

A string hashed with MD5 (default) or SHA512 cannot be reversed to plain text.

EncryptSha512(string, string)

Encrypts the specified value using the salt with SHA512.

public static string EncryptSha512(string value, string salt)

Parameters

value string

The value to encrypt.

salt string

The salt.

Returns

string

The hashed value.

HexToString(string)

Converts hex values to string.

public static string HexToString(string hex)

Parameters

hex string

The hex.

Returns

string

StringToHex(string)

Converts strings to hex.

public static string StringToHex(string text)

Parameters

text string

The text.

Returns

string
To top