SecureEnvironment Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a secure client session for user activation, license binding, and other rights management operations.

Namespace:   System.Security.RightsManagement
Assembly:  WindowsBase (in WindowsBase.dll)

System.Object
  System.Security.RightsManagement.SecureEnvironment

[SecurityCriticalAttribute(SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable

NameDescription
System_CAPS_pubpropertyApplicationManifest

Gets the ApplicationManifest specified when the SecureEnvironment was created.

System_CAPS_pubpropertyUser

Gets the user or user-group specified when the SecureEnvironment was created.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticCreate(String, AuthenticationType, UserActivationMode)

Creates a secure client session given an application rights manifest, AuthenticationType, and UserActivationMode.

System_CAPS_pubmethodSystem_CAPS_staticCreate(String, ContentUser)

Creates a secure client session for a specified user with a given rights manifest.

System_CAPS_pubmethodDispose()

Releases all resources used by the SecureEnvironment.

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the SecureEnvironment and optionally releases the managed resources.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetActivatedUsers()

Returns a list of the activated users.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticIsUserActivated(ContentUser)

Indicates whether a given user has been activated for accessing rights managed content.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticRemoveActivatedUser(ContentUser)

Removes the license activation for a specified user.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

As with other System.Security.RightsManagement types, SecureEnvironment is only usable in full trust applications.

The following example shows use of the SecureEnvironment class

string applicationManifest = "<manifest></manifest>";
if (File.Exists("rpc.xml"))
{
    StreamReader manifestReader = File.OpenText("rpc.xml");
    applicationManifest = manifestReader.ReadToEnd();
}

if (_secureEnv == null)
{
    if (SecureEnvironment.IsUserActivated(new ContentUser(
                _currentUserId, AuthenticationType.Windows)))
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest, new ContentUser(
                _currentUserId, AuthenticationType.Windows));
    }
    else
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest,
            AuthenticationType.Windows,
            UserActivationMode.Permanent);
    }
}

.NET Framework
Available since 3.0

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

Return to top
Show: