SPSecurity.SetApplicationCredentialKey Method

Sets a string that is used in encrypting and decrypting passwords.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

public static void SetApplicationCredentialKey(
	SecureString password


Type: System.Security.SecureString

A SecureString that represents a key that will be used to encrypt and decrypt passwords.

The key passed as the parameter should be long and difficult to guess, just as a password is.

The key is stored in the registry.

Use the same key on all servers in the farm.

Only encrypted passwords are stored in the Microsoft SharePoint Foundation 2010 database.

This example shows how to call the SetApplicationCredentialKey method. You code file will require a using System.Security statement.

String key = "kEy5;("
SecureString secureString = new SecureString();

foreach (char ch in key)