This section describes the processing rules of the transform. The rules are written as three functions; the inputs and outputs of the transform are the inputs and outputs of the decryptIncludedNodes() function, which itself calls the decryptXML() or decryptOctets() function.
The transform operates over a node-set X, and its parsing context , which consists of the following items:
where X is a node-set, e is an element node with the type
xenc:EncryptedData in X, and C is a parsing context of
X. Y is a node-set obtained by the following steps:
(In decryptXML(), all of the steps except the actual decryption are necessary because XPath does not permit one to remove and then replace a node. Consequently, we must serialize (1), wrap (2), reparse (4), and trim the node set (5).)
This appendix specifies the process for wrapping text in a certain parsing context, which is performed in decryptXML() (section 2.1.1). The process is a part of the process proposed by Richard Tobin in [Tobin] for constructing the infoset [XML-Infoset] of an external entity.
The process consists of the following steps:
dummy element start-tag with namespace
declaration attributes declaring all the namespaces in the
parsing context.
dummy element end-tag.
In the above steps, the document type declaration and
dummy element tags MUST be encoded in UTF-8.
Consider the following document containing an
EncryptedData element:
<!DOCTYPE Document [
<!ENTITY dsig "http://www.w3.org/2000/09/xmldsig#">
]>
<Document xmlns="http://example.org/">
<foo:Body xmlns:foo="http://example.org/foo">
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#"
Type="http://www.w3.org/2001/04/xmlenc#Element">
...
</EncryptedData>
</foo:Body>
</Document>
If the EncryptedData element is fed through the
decryption transform and is decrypted to the text
"<One><foo:Two/></One>", then the
text will be wrapped as follows:
<?xml version="1.0"?>
<!DOCTYPE dummy [
<!ENTITY dsig "http://www.w3.org/2000/09/xmldsig#">
]>
<dummy xmlns="http://example.org/"
xmlns:foo="http://example.org/foo"><One><foo:Two/></One></dummy>