0

ハッシュの何が問題になったのかを把握しようとしています。SOAP 応答として「ハッシュ値が一致しません」というエラーが表示されます。

サーバーログは実際にこのハッシュ値について不平を言っていますか? 消化値

     <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
              <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
              <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
              <Reference URI="#_1">
                <Transforms>
                  <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                </Transforms>
                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                <DigestValue>l6kqP048t5INzJT3W8gxVSXplaE=</DigestValue>
              </Reference>

So Now I am trying to compare this DigestValue  with my code computed hash. 
Not sure how else I could try to fix this 

1) この要素に移動します。この GetBytes を実行できますか?

 XmlNode xmlnodeSigDigestValue = dc.DocumentElement.SelectSingleNode("/s:Envelope/s:Header/o:Security/sig:Signature", nsmgr).ChildNodes[0].ChildNodes[2].ChildNodes[2]";
 string sSourceData = xmlnodeSigDigestValue.FirstChild.Value;//brings me to l6kqP048t5INzJT3W8gxVSXplaE
 byte[] tmpHash = ASCIIEncoding.ASCII.GetBytes(sSourceData);    

2) これが私のリクエストの実際の内容です。これを暗号化して署名しています

 string ToCompare = @"ISA*00*00*ZZ*400034 *ZZ*100000 0507*1750*^*00501**IL*1*PELEYTAY*JAVIER~REF*SY*5~DMG*D8*1981*M~DTP*291*RD8*20130115-20130115~EQ*30~SE*14*0001~GE*1*456452~IEA*1*526208405~";
byte[] tmpNewHash;
tmpNewHash = new MD5CryptoServiceProvider().ComputeHash(tmpSource);
bool bEqual = false;
if (tmpNewHash.Length == tmpHash.Length)
{
    int i=0;
    while ((i < tmpNewHash.Length) && (tmpNewHash[i] == tmpHash[i]))
    {
        i += 1;
    }
    if (i == tmpNewHash.Length) 
    {
        bEqual = true;
    }
}

これら2つを比較できますか?私はそれを正しく理解していますか?他にどのようにハッシュを比較しますか?

4

0 に答える 0