Share via


UsernameTokenManager.DefaultKeyAlgorithm Property

Gets or sets the default key algorithm for UsernameToken security tokens.

Namespace: Microsoft.Web.Services2.Security.Tokens
Assembly: Microsoft.Web.Services2 (in microsoft.web.services2.dll)

Usage

'Usage
Dim usernameTokenManager1 As UsernameTokenManager

Dim returnValue As String
returnValue = usernameTokenManager1.DefaultKeyAlgorithm

Dim sampleValue As String
usernameTokenManager1.DefaultKeyAlgorithm = sampleValue

Syntax

'Declaration
Public Shadows Overridable Property DefaultKeyAlgorithm() As String
public virtual new string DefaultKeyAlgorithm {get; set;}
public: property String^ DefaultKeyAlgorithm{
    String^ get();
    Void set(String^);
}
public System.String get_DefaultKeyAlgorithm();
public void set_DefaultKeyAlgorithm(System.String);
public hide function get DefaultKeyAlgorithm() : String;
public hide function set DefaultKeyAlgorithm(String);

Property Value

The default key algorithm for UsernameToken security tokens.

Example

The following code example shows how to change the default key algorithm for a UsernameToken security token to AES256.

Dim stm As ISecurityTokenManager = SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken)
stm.DefaultKeyAlgorithm = "AES256"
      Dim token As UsernameToken = new UsernameToken(username, passwordEquivalent, PasswordOption.SendHashed)
ISecurityTokenManager stm = SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken);
stm.DefaultKeyAlgorithm = "AES256";
      UsernameToken token = new UsernameToken(username, passwordEquivalent, PasswordOption.SendHashed);

Exceptions

Exception type Condition
System.ArgumentNullException

The value for the default key algorithm is not valid.

Remarks

If not specified, the value for the default key algorithm is AES128. Valid values for the default key algorithm are AES128, AES192, AES256, TripleDES, RSA15, and RSAOAEP. RSAOAEP is not supported on versions of Windows that are earlier than Microsoft(r) Windows(r) XP.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

Windows 2000, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, Pocket PC, Windows CE, Smart Phone

See Also

Reference

UsernameTokenManager Class
Microsoft.Web.Services2.Security.Tokens Namespace

Other Resources

UsernameTokenManager Members