Hello,

The ComputeSignature method of the SignedXml class is used to make the
XML file with the following signatures.

Development setting: Visual Studio 2005 Professional
language: VB2005 . Netframework2.0


The DigestValue node value of piece first is sha1 hush value of the
composition information tag.
The DigestValue node value of piece second is sha1 hush value of
another file (49500_01.xml).
The SignatureValue node value is an e-signature value of the
SignedInfo value.
The DigestValue node value and the SignatureValue node value of this
first piece cannot be calculated accurately and it embarrasses it.

↓Japanese is set to the element name of XML.

<?xml version="1.0" encoding="UTF-8"?>
<DataRoot>
 <構成情報 ID="構成情報">
  <管理情報>
   <手続番号>
    <機関ID>1004</機関ID>
    <手続>4950000</手続>
   </手続番号>
  </管理情報>
 </構成情報>
 <署名情報>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#";
Id="20100513115947">
   <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="#%E6%A7%8B%E6%88%90%E6%83%85%E5%A0%B1">
  <Transforms>
  <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-
c14n-20010315"/>
  </Transforms>
  <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
  <DigestValue>Xas26DM68fRhTverewa</DigestValue>
  </Reference>
  <Reference URI="49500_01.xml">
  <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
  <DigestValue>tiYs61aFCmcC5oAet/3szsG4zvA=</DigestValue>
  </Reference>
  </SignedInfo>
  <SignatureValue>Xx
+7iXHGEqqEK9z8DPzCglwrTXKN0pRgSmYwahS5vbmJHx1xTFI9XTw/
esb87I61G5WewWkSqA7A</SignatureValue>
  <KeyInfo>
  <X509Data>
  <X509Certificate>MIIEBzCCAu
+gAwIBAgIERrBOdjANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJKUDERMA8GA</
X509Certificate>
  </X509Data>
 </KeyInfo>
 </Signature>
 </署名情報>
</DataRoot>


When above-mentioned DigestValue and SignatureValue were calculated,
the following mounting two patterns was tried.
I hope if there is advice because both are also imperfect however.


1.Detached to another external file
The following SignedXml objects were set.
Value (\eg.xml) to which Reference of piece first is set is a file
that exports the composition information node.
Under such a condition, the SignatureValue value was not requested
accurately though the DigestValue value was requested accurately when
the ComputeSignature method was executed.
It is recognized that it causes with the SignatureValue value not
accurate because it is a value that the URI value should calculate.

Is not DigestValue calculated by assumption that the hash value in the
SignedInfo node has calculated correctly, and is there a method of
calculating only the SignatureValue value based on the SignedInfo node
though it is a question here?

<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="C:\eg.xml">
   <Transforms>
    <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-
c14n-20010315"/>
   </Transforms>
   <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
   <DigestValue>XasM68vUzGSDRWi0p8Eg=</DigestValue>
  </Reference>
  <Reference URI="C:\495000005583005603_01.xml">
   <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
   <DigestValue>tiYs61mcC5o</DigestValue>
  </Reference>
 </SignedInfo>
 <SignatureValue>JUcFmew7mLi3U45B4kzZKM</SignatureValue>
</Signature>

※eg.xml
<構成情報 ID="構成情報">
 <管理情報>
  <手続番号>
   <機関ID>1004</機関ID>
   <手続>4950000</手続>
  </手続番号>
 </管理情報>
</構成情報>


2.SignedXml objects of following Enveloping to the XML element in the
same file were set.
The value to which Reference of piece first is set is ID value to
refer to the hush calculation object.
Under such a condition, when the ComputeSignature method was executed,
the DigestValue value of piece first was accurate the DigestValue
value of piece second. Because DigestValue was inaccurate, the
SignatureValue value was also inaccurate.
Is there a part that should be improved?
(It is thought that SignatureValue can be calculated accurately if the
SignedXml object is set to calculate even the DigestValue value of
piece first accurately. )


<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="#%E6%A7%8B%E6%88%90%E6%83%85%E5%A0%B1">
   <Transforms>
    <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-
c14n-20010315"/>
   </Transforms>
   <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
   <DigestValue>WRFhGHaaa</DigestValue>
  </Reference>
  <Reference URI="49500_01.xml">
   <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
   <DigestValue>tiYs61mcC5o</DigestValue>
  </Reference>
 </SignedInfo>
 <SignatureValue>XBOqdoYcg/5zwe24OosdYkV1Ei0IuewXq4wn4oc3P4rg</
SignatureValue>
 <Object Id="%E6%A7%8B%E6%88%90%E6%83%85%E5%A0%B1">
  <構成情報 ID="構成情報" xmlns="">
   <手続番号>
    <機関ID>1004</機関ID>
    <手続>4950000</手続>
   </手続番号>
  </管理情報>
 </Object>
</Signature>

Reply via email to