Search code examples
vb.netcryptographyc14n

Error Type 'XmlDsigC14NTransform' is not defined


My code starts with:

Imports System.Security.Cryptography
Imports System.Text
Imports System.Xml
Imports System.IO

But when I try to normalise my XML document using C14N:

 Dim c14n = New XmlDsigC14NTransform

I get an error:

Code BC30002 Type 'XmlDsigC14NTransform' is not defined

I have used the same code before without errors. I'm using target framework .NET Framework 4 Client Profile, is it likely I'm missing a reference?


Solution

  • If you haven't already done so, you need to add a reference to System.Security. Then add Imports System.Security.Cryptography.Xml to your list of imports (or fully qualify XmlDsigC14NTransform.

    The Namespace and assembly is documented in MSDN's article on XmlDsigC14NTransform.