SecureEnvironment Class

Definition

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

C#
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
C#
public class SecureEnvironment : IDisposable
Inheritance
SecureEnvironment
Attributes
Implements

Examples

The following example shows use of the SecureEnvironment class

C#
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);
    }
}

Remarks

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

Properties

ApplicationManifest

Gets the ApplicationManifest specified when the SecureEnvironment was created.

User

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

Methods

Create(String, AuthenticationType, UserActivationMode)

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

Create(String, ContentUser)

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

Dispose()

Releases all resources used by the SecureEnvironment.

Dispose(Boolean)

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

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetActivatedUsers()

Returns a list of the activated users.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsUserActivated(ContentUser)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveActivatedUser(ContentUser)

Removes the license activation for a specified user.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9