Export (0) Print
Expand All

UseLicense Class

Represents a license that enables access to protected rights managed content.

System.Object
  System.Security.RightsManagement.UseLicense

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

'Declaration
Public Class UseLicense

The UseLicense type exposes the following members.

  NameDescription
Public methodUseLicenseInitializes a new instance of the UseLicense class.
Top

  NameDescription
Public propertyApplicationDataGets the application data dictionary that contains key/value pairs passed from the publishing application to the consuming application.
Public propertyContentIdGets the content identifier created by the publisher.
Public propertyOwnerGets the owner of the license.
Top

  NameDescription
Public methodBindBinds the license to a given SecureEnvironment.
Public methodEqualsIndicates if this license is equivalent to another given license. (Overrides Object.Equals(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 methodGetHashCodeReturns the hash code associated with this license. (Overrides Object.GetHashCode.)
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 used to create this license. (Overrides Object.ToString.)
Top

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

The following example shows how to use this class to initialize a PublishLicense.

				WriteStatus("   Signing the UnsignedPublishLicense" & vbLf & "       to build the PublishLicense.")
                Dim authorsUseLicense As UseLicense = Nothing
				Dim publishLicense As PublishLicense = unsignedLicense.Sign(_secureEnv, authorsUseLicense)

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

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

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

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

				WriteStatus("Verifying package encryption.")
				If EncryptedPackageEnvelope.IsEncryptedPackageEnvelope(encryptedFile) Then
					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." & vbLf)
					Return False
				End If

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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:
© 2015 Microsoft