You will have to add the assembly System.Security to the project-->References.
My example should work as is because I have added the ilusing directives to the top which bring in the required namespaces.
$set ilusing"System.Xml"
$set ilusing"System.Security.Cryptography"
$set ilusing"System.Security.Cryptography.Xml"
In Robert's example you would have to add these.
My example uses a declare statement to define the exml data-item and Robert's defines this in local-storage.
Either method should work for you.