XmlLicenseTransform Class


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

Represents the license transform algorithm used to normalize XrML licenses for signatures.

Namespace:   System.Security.Cryptography.Xml
Assembly:  System.Security (in System.Security.dll)


<HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort := True)>
Public Class XmlLicenseTransform
	Inherits Transform


Initializes a new instance of the XmlLicenseTransform class.


Gets or sets the Uniform Resource Identifier (URI) that identifies the algorithm performed by the current transform.(Inherited from Transform.)


Gets or sets an XmlElement object that represents the document context under which the current Transform object is running. (Inherited from Transform.)


Gets or sets the decryptor of the current XmlLicenseTransform object.


Gets an array of types that are valid inputs to the OutputTypes method of the current XmlLicenseTransform object.(Overrides Transform.InputTypes.)


Gets an array of types that are valid outputs from the OutputTypes method of the current XmlLicenseTransform object.(Overrides Transform.OutputTypes.)


Gets or sets a Hashtable object that contains the namespaces that are propagated into the signature. (Inherited from Transform.)


Sets the current XmlResolver object.(Inherited from Transform.)


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


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


When overridden in a derived class, returns the digest associated with a Transform object. (Inherited from Transform.)


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


Returns an XML representation of the parameters of an XmlLicenseTransform object that are suitable to be included as subelements of an XMLDSIG <Transform> element.(Overrides Transform.GetInnerXml().)


Returns the output of an XmlLicenseTransform object.(Overrides Transform.GetOutput().)


Returns the output of an XmlLicenseTransform object.(Overrides Transform.GetOutput(Type).)


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


Returns the XML representation of the current Transform object.(Inherited from Transform.)


Parses the specified XmlNodeList object as transform-specific content of a <Transform> element; this method is not supported because the XmlLicenseTransform object has no inner XML elements.(Overrides Transform.LoadInnerXml(XmlNodeList).)


Loads the specified input into the current XmlLicenseTransform object.(Overrides Transform.LoadInput(Object).)


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


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

The XmlLicenseTransform class represents the license transform algorithm as defined in the MPEG Rights Extension Language (MPEG REL).

Use the XmlLicenseTransform class to transform XrML licenses for signatures.

The Uniform Resource Identifier (URI) that describes the XmlLicenseTransform class is defined by the XmlLicenseTransformUrl field.

The following code example shows how to validate an XML digital signature using the IRelDecryptor interface and the XmlLicenseTransform class.

    Public Shared Sub CheckSignatureWithEncryptedGrant(ByVal fileName As String, ByVal decryptor As IRelDecryptor)
        ' Create a new XML document.
        Dim xmlDocument As New XmlDocument()
        Dim nsManager As New XmlNamespaceManager(xmlDocument.NameTable)

        ' Format using whitespaces.
        xmlDocument.PreserveWhitespace = True

        ' Load the passed XML file into the document. 
        nsManager.AddNamespace("dsig", SignedXml.XmlDsigNamespaceUrl)

        ' Find the "Signature" node and create a new XmlNodeList object.
        Dim nodeList As XmlNodeList = xmlDocument.SelectNodes("//dsig:Signature", nsManager)

        Dim count = nodeList.Count
        Dim i As Integer

        For i = 0 To count
            Dim clone As XmlDocument = xmlDocument.Clone()

            Dim signatures As XmlNodeList = clone.SelectNodes("//dsig:Signature", nsManager)

            ' Create a new SignedXml object and pass into it the XML document clone.
            Dim signedXml As New SignedXml(clone)

            ' Load the signature node.
            signedXml.LoadXml(CType(signatures(i), XmlElement))

            ' Set the context for license transform
            Dim trans As Transform = CType(signedXml.SignedInfo.References(0), Reference).TransformChain(0)

            If TypeOf trans Is XmlLicenseTransform Then

                ' Decryptor is used to decrypt encryptedGrant elements.
                If Not (decryptor Is Nothing) Then
                    CType(trans, XmlLicenseTransform).Decryptor = decryptor
                End If

            End If

            ' Check the signature and display the result.
            Dim result As Boolean = signedXml.CheckSignature()

            If result Then
                Console.WriteLine("SUCCESS: CheckSignatureWithEncryptedGrant - issuer index #" + i.ToString())
                Console.WriteLine("FAILURE: CheckSignatureWithEncryptedGrant - issuer index #" + i.ToString())
            End If
        Next i

    End Sub
End Class

.NET Framework
Available since 2.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