gerard
gerard

Reputation: 1000

Canonicalise XML file using PowerShell

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:

  1. Create DOM representation of the XML file
  2. Create canonicalised representation of the DOM
  3. Generate digital signature of the canonicalised representation using SHA-256.
  4. Encode the binary signature into base64 encoded string
  5. Place signature string in the SOAP message

Upvotes: 2

Views: 365

Answers (0)

Related Questions