SPSecurity.SetApplicationCredentialKey method
設定字串,使用加密和解密的密碼。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Shared Sub SetApplicationCredentialKey ( _
password As SecureString _
)
'用途
Dim password As SecureStringSPSecurity.SetApplicationCredentialKey(password)
public static void SetApplicationCredentialKey(
SecureString password
)
參數
password
Type: System.Security.SecureStringSecureString表示將用來加密和解密的密碼金鑰。
備註
如同密碼是長且很難猜到了,應該是當做參數傳遞的索引鍵。
金鑰儲存在登錄中。
在陣列中的所有伺服器上使用相同的金鑰。
Microsoft SharePoint Foundation 2010資料庫中儲存加密的密碼。
Examples
本範例示範如何呼叫SetApplicationCredentialKey方法。您的程式碼檔將會需要using System.Security陳述式。
String key = "kEy5;("
SecureString secureString = new SecureString();
foreach (char ch in key)
{
secureString.AppendChar(ch);
}
secureString.MakeReadOnly();
SPSecurity.SetApplicationCredentialKey(secureString);
Dim key As String = "kEy5;("
SecureString secureString = New SecureString()
For Each ch As Char In key
secureString.AppendChar(ch)
Next ch
secureString.MakeReadOnly()
SPSecurity.SetApplicationCredentialKey(secureString)