Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. HOW TO SIGN XML FILE IN .NET COMPACT EDITION

HOW TO SIGN XML FILE IN .NET COMPACT EDITION

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharphelpsecurityxmltutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlexB47
    wrote on last edited by
    #1

    I need help for sign an XML files with (signature tag). Nothing problem if the platform is a standard PC but in .NET COMPACT FRAMEWORK for windows mobile 6 I have problems. First .. exist Systems.Security in .NET CF? 2.0 or 3.5? Where are? this is my code for Pc ..:

    Public Function Firma(ByVal XmlFile as String) As Boolean
    Dim signedXML as String = "c:\signedXML.xml"
    ' setup the document to sign
    Dim doc As XmlDocument = New XmlDocument()
    doc.Load(XmlFile)
    Dim signer As SignedXml = New SignedXml(doc)

    'setup the key used to sign 
    Dim key As Security.Cryptography.RSA = New Security.Cryptography.RSACryptoServiceProvider()
    signer.KeyInfo = New Security.Cryptography.Xml.KeyInfo()
    
    signer.KeyInfo.AddClause(New Security.Cryptography.Xml.RSAKeyValue(key))
    signer.SigningKey = key
    
    'create a reference to the root of the document 
    Dim orderRef As Security.Cryptography.Xml.Reference = New Security.Cryptography.Xml.Reference("")
    orderRef.AddTransform(New Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform())
    orderRef.DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256"
    
    signer.AddReference(orderRef)
    
    'add transforms that only select the order items, type, and 
    'compute the signature, and add it to the document 
    signer.ComputeSignature()
    doc.DocumentElement.AppendChild(signer.GetXml())
    doc.Save(signedXML)
    

    End Function

    Alex

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups