Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Class SimpleEncryption

An easy-to-use class to encrypt/decrypt strings.

Inheritance
System.Object
SimpleEncryption
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Util
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[Obsolete("This class is based on Triple DES and is being phased out in favor of stronger encryption methods.")]
public sealed class SimpleEncryption : IDisposable

Constructors

SimpleEncryption(String)

Constructor that initializes the crypto functions.

Declaration
public SimpleEncryption(string initializer)
Parameters
Type Name Description
System.String initializer

A string that will be used to create the crypto key

Methods

ClearText(String, String)

Returns a encrypted string in clear-text

Declaration
public string ClearText(string key, string val)
Parameters
Type Name Description
System.String key

The key used for the encryption algorithm

System.String val

The value to be decrypted

Returns
Type Description
System.String

A clear-text string

Decrypt(String, String)

Decrypt a string

Declaration
public string Decrypt(string key, string encryptedText)
Parameters
Type Name Description
System.String key

An extra key that is used to set a salt (i e initial vector) for the decryption.

System.String encryptedText

The text to decrypt

Returns
Type Description
System.String

Decrypted string

Dispose()

Declaration
public void Dispose()

Encrypt(String, String)

Encrypt a string

Declaration
public string Encrypt(string key, string plainText)
Parameters
Type Name Description
System.String key

An extra key that is used to set a salt (i e initial vector) for the encryption.

System.String plainText

The text to encrypt

Returns
Type Description
System.String

Encrypted string

EncryptedText(String, String)

Encrypts a string

Declaration
public string EncryptedText(string key, string val)
Parameters
Type Name Description
System.String key

The key used for the encryption algorithm

System.String val

The value to be encrypted

Returns
Type Description
System.String

The encrypted string

IsEncrypted(String)

Check if an existing string is encrypted based on prefix

Declaration
public bool IsEncrypted(string val)
Parameters
Type Name Description
System.String val

The string to check

Returns
Type Description
System.Boolean

True if the string is encrypted

IsEncryptRequest(String)

Check if an existing string requests encryption based on the prefix

Declaration
public bool IsEncryptRequest(string val)
Parameters
Type Name Description
System.String val

The string to check

Returns
Type Description
System.Boolean

True if the string requests encryption

Implements

System.IDisposable

Extension Methods