Skip to content

ICryptoHelper Interface

Tricklebyte edited this page Jan 30, 2020 · 3 revisions

Represents a type used for low-level cryptography operations

Methods

Protect(String, String, String)

Encrypts a setting value using the setting key as the purpose string.

 string Protect(string settingName, string plainText,string encValPrefix);

Parameters

settingName String
The full key of the setting to be encrypted

plainText String
The plain-text value of the setting to be encrypted

encValPrefix String
The prefix to be added to the ciphertext string after encryption. This prefix will be used by the client to identify encrypted settings in order to decrypt them.

Returns

String
The ciphertext value of the encrypted setting, including the encrypted value prefix


Unprotect(String, String, String)

Decrypts a setting value using the setting key as the purpose string.

 string Unprotect(string settingName, string encryptedText,string encValPrefix);

Parameters

settingName String
The full key of the setting to be decrypted

plainText String
The cipher-text value of the setting to be decrypted

encValPrefix String
The prefix to be removed from the ciphertext string prior to decryption.

Returns

String
The plaintext value of the encrypted setting


AddEncValPrefix(String, String)

Adds the prefix to the ciphertext after encryption. The client uses the prefix to identity encrypted settings during the decryption process. If the encrypted string does not begin with the prefix, it will not be decrypted by the client.

 string AddEncValPrefix(string encValPrefix, string encryptedValue)

Parameters

encValPrefix String
The prefix used to identify encrypted values

encryptedValue String
The encrypted value string without prefix

Returns

String
The concatenation of the encValPrefix and encryptedValue parameters


RemoveEncValPrefix(String, String)

Removes the prefix value from the setting string prior to decryption. Decryption will fail if the prefix is not removed first.

 string RemoveEncValPrefix(string encValPrefix, string encryptedValue)

Parameters

encValPrefix String
The prefix used to identify encrypted values

encryptedValue String
The full cipher-text value of the setting to be decrypted including prefix

Returns

String
The encryptedValue base string without the encrypted value prefix.

Clone this wiki locally