This documentation is archived and is not being maintained.

PublishLicense Class

Represents a signed rights managed publish license.

System.Object
  System.Security.RightsManagement.PublishLicense

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

public class PublishLicense

The PublishLicense type exposes the following members.

  NameDescription
Public methodPublishLicenseInitializes a new instance of the PublishLicense class from a specified serialized and signed PublishLicense.
Top

  NameDescription
Public propertyContentIdGets the publisher-created content identifier.
Public propertyReferralInfoNameGets the contact name for the author or publisher of the content.
Public propertyReferralInfoUriGets the contact URI for the author or publisher of the content.
Public propertyUseLicenseAcquisitionUrlGets the URI to use for acquiring a UseLicense.
Top

  NameDescription
Public methodAcquireUseLicenseAttempts to acquire a UseLicense for a user or user group in a specified SecureEnvironment.
Public methodAcquireUseLicenseNoUIAttempts to acquire a UseLicense for a user or user group in a specified SecureEnvironment.
Public methodDecryptUnsignedPublishLicenseReturns a decrypted UnsignedPublishLicense version of this signed PublishLicense.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns the serialized XrML string that was used to create this license. (Overrides Object.ToString().)
Top

PublishLicense defines security data about rights, users, and other security-related information. The license defines how a specific user on a specific computer can use specified rights managed content.

The publishing process begins with the document author, who defines rights information in an UnsignedPublishLicense. Next, the author creates a signed PublishLicense by calling the Sign method of the UnsignedPublishLicense. The serialized form of the signed PublishLicense can then be provided to end users who can use it to acquire a UseLicense by calling the AcquireUseLicense method of the PublishLicense. The returned UseLicense then allows the client application to exercise the rights that were granted to the user.

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

The following example shows how to initialize a PublishLicense by using the Sign method.


WriteStatus("   Signing the UnsignedPublishLicense\n" +
            "       to build the PublishLicense.");
UseLicense authorsUseLicense;
PublishLicense publishLicense =
    unsignedLicense.Sign(_secureEnv, out authorsUseLicense);

WriteStatus("   Binding the author's UseLicense and");
WriteStatus("       obtaining the CryptoProvider.");
CryptoProvider cryptoProvider = authorsUseLicense.Bind(_secureEnv);

WriteStatus("   Creating the EncryptedPackage.");
Stream packageStream = File.OpenRead(packageFile);
EncryptedPackageEnvelope ePackage =
    EncryptedPackageEnvelope.CreateFromPackage(encryptedFile,
        packageStream, publishLicense, cryptoProvider);

WriteStatus("   Adding an author's UseLicense.");
RightsManagementInformation rmi =
    ePackage.RightsManagementInformation;
rmi.SaveUseLicense(author, authorsUseLicense);

ePackage.Close();
WriteStatus("   Done - Package encryption complete.");

WriteStatus("Verifying package encryption.");
if (EncryptedPackageEnvelope.IsEncryptedPackageEnvelope(encryptedFile))
{
    WriteStatus("   Confirmed - '" + encryptedFilename +
                "' is encrypted.");
}
else
{
    MessageBox.Show("ERROR: '" + encryptedFilename +
        "' is NOT ENCRYPTED.", "Encryption Error",
        MessageBoxButton.OK, MessageBoxImage.Error);
    WriteStatus("ERROR: '" + encryptedFilename +
                "' is NOT ENCRYPTED.\n");
    return false;
}


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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