Encrypt and decrypt passwords

Relevant for: API testing only

Password fields expect an encrypted string - if you provide an unencrypted string, the authentication will fail.

The EncryptionMngr method lets you encrypt and decrypt strings within your events.

In this topic:

Encrypt the password

Use the activity's context's EncryptionMngr method, and select Encrypt from the autocompletion drop-down. The following example encrypts a password.

string plainText = "myPassword";
string encryptedText = this.StServiceCallActivity4.Context.EncryptionMngr.Encrypt(plainText);

Back to top

Decrypt the password - optional

Use the Decrypt method from the autocompletion drop-down.

The following example decrypts a password and validates it against the original string.

string decryptedText = this.StServiceCallActivity4.Context.EncryptionMngr.Decrypt(encryptedText);
bool equalText = decryptedText.Equals(plainText);

Back to top