XmlLicenseTransform Class

 

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

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

System.Object
  System.Security.Cryptography.Xml.Transform
    System.Security.Cryptography.Xml.XmlLicenseTransform

[HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
public class XmlLicenseTransform : Transform

NameDescription
System_CAPS_pubmethodXmlLicenseTransform()

Initializes a new instance of the XmlLicenseTransform class.

NameDescription
System_CAPS_pubpropertyAlgorithm

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

System_CAPS_pubpropertyContext

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

System_CAPS_pubpropertyDecryptor

Gets or sets the decryptor of the current XmlLicenseTransform object.

System_CAPS_pubpropertyInputTypes

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

System_CAPS_pubpropertyOutputTypes

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

System_CAPS_pubpropertyPropagatedNamespaces

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

System_CAPS_pubpropertyResolver

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

NameDescription
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_pubmethodGetDigestedOutput(HashAlgorithm)

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

System_CAPS_pubmethodGetHashCode()

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

System_CAPS_protmethodGetInnerXml()

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().)

System_CAPS_pubmethodGetOutput()

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

System_CAPS_pubmethodGetOutput(Type)

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

System_CAPS_pubmethodGetType()

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

System_CAPS_pubmethodGetXml()

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

System_CAPS_pubmethodLoadInnerXml(XmlNodeList)

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).)

System_CAPS_pubmethodLoadInput(Object)

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

System_CAPS_protmethodMemberwiseClone()

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

System_CAPS_pubmethodToString()

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 static void CheckSignatureWithEncryptedGrant(string fileName, IRelDecryptor decryptor)
{
    // Create a new XML document.
    XmlDocument xmlDocument = new XmlDocument();
    XmlNamespaceManager nsManager = new XmlNamespaceManager(xmlDocument.NameTable);

    // Format using whitespaces.
    xmlDocument.PreserveWhitespace = true;

    // Load the passed XML file into the document. 
    xmlDocument.Load(fileName);
    nsManager.AddNamespace("dsig", SignedXml.XmlDsigNamespaceUrl);

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

    for (int i = 0, count = nodeList.Count; i < count; i++)
    {
        XmlDocument clone = xmlDocument.Clone() as XmlDocument;
        XmlNodeList signatures = clone.SelectNodes("//dsig:Signature", nsManager);

        // Create a new SignedXml object and pass into it the XML document clone.
        SignedXml signedXml = new SignedXml(clone);

        // Load the signature node.
        signedXml.LoadXml((XmlElement)signatures[i]);

        // Set the context for license transform
        Transform trans = ((Reference)signedXml.SignedInfo.References[0]).TransformChain[0];

        if (trans is XmlLicenseTransform)
        {

            // Decryptor is used to decrypt encryptedGrant elements.
            if (decryptor != null)
                (trans as XmlLicenseTransform).Decryptor = decryptor;
        }

        // Check the signature and display the result.
        bool result = signedXml.CheckSignature();

        if (result)
            Console.WriteLine("SUCCESS: CheckSignatureWithEncryptedGrant - issuer index #" +
                                            i.ToString());
        else
            Console.WriteLine("FAILURE: CheckSignatureWithEncryptedGrant - issuer index #" +
                                            i.ToString());
    }

}

.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
Show: