none
Verifying XML Digital Signature - CheckSignature() returns false or true depending on whether xml file has namespaces or not. RRS feed

  • Question

  • Hello,

    I am trying to sign and verify an XML file. I am able to sign the file (using xades) but I am still having trouble with verifying XML file. Verifying process works sometimes and sometimes does not work. I mean CheckSignature() returns false or true depending on whether xml file has namespaces or not.

    <envelope>
      <data id="data1">
        <item>Item 1</item>
        <item>Item 2</item>
        <item>Item 3</item>
      </data>
    </envelope>


    For example, If I use this xml, I can sign and verify it successfully. But If I use the xml content below, I can just sign and CheckSignature() returns false.

    <edefter:defter xmlns:edefter="http://www.edefter.gov.tr" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.edefter.gov.tr ../xsd/edefter.xsd">
    	<xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:iso639="http://www.xbrl.org/2005/iso639" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:gl-bus="http://www.xbrl.org/int/gl/bus/2006-10-25" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gl-cor="http://www.xbrl.org/int/gl/cor/2006-10-25" xmlns:gl-plt="http://www.xbrl.org/int/gl/plt/2006-10-25" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
    		<link:schemaRef xlink:href="../xsd/2006-10-25/plt/case-c-b/gl-plt-2006-10-25.xsd" xlink:type="simple" /> 
    		<xbrli:context id="ledger_context">
    			<xbrli:entity>
    				<xbrli:identifier scheme="http://www.gib.gov.tr">1234567890</xbrli:identifier>
    			</xbrli:entity>
    			<xbrli:period>
    				<xbrli:instant>2011-02-01</xbrli:instant>
    			</xbrli:period>
    		</xbrli:context>
    		<xbrli:unit id="try">
    			<xbrli:measure>iso4217:TRY</xbrli:measure>
    		</xbrli:unit>
    		<xbrli:unit id="countable">
    			<xbrli:measure>xbrli:pure</xbrli:measure>
    		</xbrli:unit>
    .......................
    
    ........................

    I think the problem is that there are namespaces in this xml file but I don't know how I can handle that.

    Can anybody explain how to handle this problem?

    (If necessary, I can pay for this help.)

    Thanks.

    Murat.



    • Edited by Murat Res Thursday, March 28, 2013 7:45 AM
    Wednesday, March 27, 2013 12:55 PM

All replies

  • Hi Murat,

    Would you like to test this with the same XML file?

    The same one with namespace and only remove namespace.

    Have a nice day.


    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Thursday, March 28, 2013 2:17 PM
  • Hi Ghost,

    I tested to verify the same xml file with namespace (like below xml) and It returned false again. I'm pretty sure that the problem is caused by namespaces.

    <?xml version="1.0" encoding="UTF-8"?>
    <h:envelope xmlns:h="http://www.w3.org/TR/html4/">
      <h:data id="data1">
        <h:item>Item 1</h:item>
        <h:item>Item 2</h:item>
        <h:item>Item 3</h:item>
      </h:data>
    </h:envelope>

    Did you encounter a situation like this before?

    I'm going crazy, please help?

    Thursday, March 28, 2013 3:39 PM
  • Hi Murat,

    I have tried to reproduce this senario. It works well with or without namespace.

    What is your

    ValidationType

    And what is the code you try to validate this xml, and sign code?

    Have a nice day.


    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Tuesday, April 2, 2013 12:13 PM