Re: Verify Signed XML document in compact framework

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Robbe Morris [C# MVP] (info_at_turnkeytools.com)
Date: 02/17/05


Date: Wed, 16 Feb 2005 19:52:45 -0500

Actually, it isn't included in the current release of the .NET CF SP2.

Sorry...

-- 
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/forumvbcode/post10017013.aspx
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
"dani" <dani@writeme.com> wrote in message 
news:762a3382.0502161326.204c61e2@posting.google.com...
>I want to convert following VB.Net code to cf Code:
>
> Is there any way to do this? Please help me. Do not say only
> System.Security.Cryptography.Xml is not included in cf..
>
> Here is the working code in vb.Net:
> (the public key is included in the xml file)
>
>
>    Public Function VerifyXMLDocument(ByVal sXMLFileName As String, _
>                                      ByVal sXMLPublicKey As String)
> As Boolean
>
>        ' Load the signed XML file.
>        Dim xmldoc As New XmlDocument
>        xmldoc.Load(sXMLFileName)
>
>        ' Create an RSA crypto service provider from the embedded
>        ' XML document resource (the public key).
>        Dim csp As New RSACryptoServiceProvider
>        csp.FromXmlString(sXMLPublicKey)
>
>        ' Create the signed XML object.
>        Dim sxml As New SignedXml(xmldoc)
>
>        ' Verify the signature.
>        If sxml.CheckSignature(csp) Then
>            Return True
>        Else
>            Return False
>        End If
>
>    End Function
>
>
> Here is the signed XML File:
>
> <?xml version="1.0" encoding="utf-16"?>
> <license>
>  <ComputerName>
>  </ComputerName>
>  <ComputerMAC>0030BD61F98A</ComputerMAC>
>  <CompanyName>
>  </CompanyName>
>  <UserName>
>  </UserName>
>  <IsServerLicense>False</IsServerLicense>
>  <MaxUser>0</MaxUser>
>  <Info>License InetConnector Proxy 1.0.1.1</Info>
> 
> <Guid>c51bfefcdfce4260923e98038fe737644967464699484c6bab54b8dcf6841b4d</Guid>
>  <PublicKey>
>    <RSAKeyValue>
> 
> <Modulus>wOP27h39Vi5oL92X9kJH4gHOlvOIQRXJZrM32pzLGlwNMm1+Ewi0o5NWmZFHTjHamRjGUQyLEOaGyBixFL7nFvOf+CwM8l1Psi4l5uCZ9deDxcfoH/w9a7KDxNDJhdd5joTvSFSupHYd+GEEpV68RQDeRy4npzcgQtfQYSXFUOc=</Modulus>
>      <Exponent>AQAB</Exponent>
>    </RSAKeyValue>
>  </PublicKey>
>  <Tool>
>    <ToolName>InetConnector Proxy</ToolName>
>    <DateCreated>20050111</DateCreated>
>    <DateExpire>99991231</DateExpire>
>    <IsTrial>False</IsTrial>
>    <IsLicensed>True</IsLicensed>
>    <SerialNumber>
>    </SerialNumber>
>    <DongleWithMAC>
>    </DongleWithMAC>
>    <Project>
>    </Project>
>    <Segment>
>    </Segment>
>    <ToolInfo>1.0.1.1</ToolInfo>
>  </Tool>
>  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
>    <SignedInfo>
>      <CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
>      <SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
>      <Reference URI="">
>        <Transforms>
>          <Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
>        </Transforms>
>        <DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
>        <DigestValue>4lgI4IIJ4aDWn6dutwvtZcXR1sk=</DigestValue>
>      </Reference>
>    </SignedInfo>
> 
> <SignatureValue>jlraLE6t3iUb5+96pjIRLA3NX/B7l6nMuh7cnObVrdHDnkZcb2DGNQfENeBy6IspvThb1mZtNJK4LwUyU5EE7b3SLiC+0l3Hk7kpCKWSYFth4+ElsSBAROCWPHVWRRQQLpQNmfC4eOZ79gqNXLhQVPE9sssLTwDKuzneqgORYQ8=</SignatureValue>
>  </Signature>
> </license> 


Relevant Pages

  • Re: Verify Signed XML document in compact framework
    ... it isn't included in the current release of the .NET CF SP2. ... >> (the public key is included in the xml file) ... >> Public Function VerifyXMLDocument(ByVal sXMLFileName As String, ... >> Here is the signed XML File: ...
    (microsoft.public.dotnet.framework.compactframework)
  • Verify Signed XML document in compact framework
    ... (the public key is included in the xml file) ... Here is the signed XML File: ... <UserName> ... <Signature xmlns="http://www.w3.org/2000/09/xmldsig #"> ...
    (microsoft.public.dotnet.framework.compactframework)
  • Extraction of signed .NET assembly public key
    ... SignedXML class in the .NET Framework. ... same Private key that I digitally sign my assembly with to sign an XML file ... and then within the application check that the XML file will verify with the ... public key that is embedded within the assembly. ...
    (microsoft.public.dotnet.languages.vb)
  • "Invalid hexadecimal character reference" error parsing an XML with SAX processor
    ... I have created a simple SAX parser for a very simple XML file. ... to the parser, the error row changes. ... public function create_parser ...
    (comp.lang.php)
  • read xml file nodes
    ... I've got the following xml file: ... <ToolTip> ... Public Function LoadToolTip(ByVal Form As String, ...
    (microsoft.public.dotnet.languages.vb)