Is there an inbuilt mechanism within PowerShell (or within .NET that can be used by PowerShell) that will allow me to canonicalise an XML file (see step 2 below)?
The canonicalisation must be based on the W3C rules described at https://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments but there must be a way to do this within .NET without having to manually implement these rules.
My use case is the following:
- Create DOM representation of the XML file
- Create canonicalised representation of the DOM
- Generate digital signature of the canonicalised representation using SHA-256.
- Encode the binary signature into base64 encoded string
- Place signature string in the SOAP message