无法从签名的XML文档创建数据集 [英] Cannot Create a DataSet from Signed XML Document

查看:73
本文介绍了无法从签名的XML文档创建数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有XML文档,我正在进行数字签名,并且需要能够将这些文档加载到DataSet对象中。但是,在检查签名

并使用DataSet.ReadXML方法后,我收到一个异常根目录

元素丢失。


我在过去24小时内一直在努力想办法解决这个问题,但是我被卡住了。我很感激

社区可以为我提供任何帮助。


谢谢,

I have XML Documents that I am digitally signing, and need to be able to load
these documents into DataSet objects. However, after checking the signature
and using the DataSet.ReadXML method, I am getting an exception "The root
element is missing".

I have struggled over the last 24 hours trying to figure out ways of
correcting this, however I am stuck. I would appreciate any help that the
community can provide me on this.

Thanks,

推荐答案

Brian,


你能发一个签名文件的例子吗?

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Brian W. Smith" <峰; br ********* @ discussions.microsoft.com>在消息中写道

news:26 ********************************** @ microsof t.com ...
Brian,

Can you post an example of the signed document?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian W. Smith" <Br*********@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
我有XML文档,我正在进行数字签名,并且需要能够将这些文档加载到DataSet对象中。但是,在检查
签名并使用DataSet.ReadXML方法后,我收到一个异常根目录
元素缺失。

我有在过去24小时内一直在努力寻找解决这个问题的方法,但是我被困住了。我很感激
社区可以为我提供的任何帮助。

谢谢,
I have XML Documents that I am digitally signing, and need to be able to
load
these documents into DataSet objects. However, after checking the
signature
and using the DataSet.ReadXML method, I am getting an exception "The root
element is missing".

I have struggled over the last 24 hours trying to figure out ways of
correcting this, however I am stuck. I would appreciate any help that the
community can provide me on this.

Thanks,



这是一个该文件的示例。该文件用于在DataSet中创建3个数据表,我使用了第一个节点位置的签名信息和最后一个节点的
。此示例使用

XmlDocument.DocumentElement.PrependChild()方法显示第一个位置的签名。


谢谢


<?xml version =" 1.0" encoding =" utf-8"?>

< FWT>

< Signature xmlns =" http://www.w3.org/2000/ 09 / xmldsig#">

< SignedInfo>

< CanonicalizationMethod

算法=" http://www.w3 .ORG / TR / 2001 / REC-xml的-C14N-20010315" />

< SignatureMethod

算法=" http://www.w3.org/2000/09/xmldsig#rsa-sha1" />

<参考URI ="">

<转换>

<转换

算法=" http://www.w3.org/2000/09/xmldsig#enveloped-signature" />

< / Transforms>

< DigestMethod Algorithm =" http://www.w3.org/2000/09/xmldsig#sha1" />

< DigestValue> hxyhMOAfdFJYOsDlADHTah0Gmmg =< / DigestValue>

< /参考>

< / SignedInfo>


将的SignatureValue> rakRKha0vAX8cIsFwhJUsgzOB1NMNW6v IG / EsTUivy4Rt3Cg2k1LDTkmJv + bXhgWBoPBtdMxg9ZSXah0P1qw5 K / 1npSWPmJ9uWGEQuWwZT5KqJNfq1iy7QKfUiKGTn1q + 0Mc2WXPo 18v6Fnuqqh7 + btrpfnvbTaKJ0mQHAw9H + 0 =< /的SignatureValue>

将密钥信息> <无线电通信/>
< KeyValue xmlns =" http://www.w3.org/2000/09/xmldsig#">

< RSAKeyValue>
<登记/>
将模量> 01k61JX5bc / jCLnnEHtzw3o08hs6 + KjE58md8wkRrBgTTEU3gtmD1Q8SxPxpJ iSwGNRCWTAghxSrK7AFYOCGZTblstnHerqs0Z / LTVNW2JaVkI34kvquqWdd6JJ + GNYWWuKuTiTjyEpLSikjXXFTW kLJqDU / w1Lq6MN6g + z6lx8 = LT; /模量>

将指数> AQAB< /指数>

< / RSAKeyValue>

< / KeyValue>

< / KeyInfo>

< / Signature> ;

< FWT_CONFIG>

< keyName> #PEREXEMPAMT< / keyNam e>

< keyValue> 3100< / keyValue>

< / FWT_CONFIG>

< FWT_FORMULA>

<步骤> 1< /步骤>

<令牌> MUL< /令牌>

< Arg1> @ TAXWAGES< / Arg1>

< Arg2> @ PAYPERIODS< / Arg2>

< Arg3> ANNUALWAGE< / Arg3>

< Arg4 />

< Arg5 />

< Arg6 />

< Arg7 />

< Arg8 /> ;

< DefValue> 0< / DefValue>

< Comment />

< / FWT_FORMULA>

< FWT_TAXTABLES>

< filingStatus> 1< / filingStatus>

< taxTableId> 3< / taxTableId>

< ; baseWage> 9700< / baseWage>

< upperWage> 30800< / upperWage>

< taxAmt> 705< / taxAmt>

< taxRate> 0.15< / taxRate>

< / FWT_TAXTABLES>

< FWT_TAXTABLES>

< filingStatus&g t; 1< / filingStatus>

< taxTableId> 4< / taxTableId>

< baseWage> 30800< / baseWage>

< ; upperWage> 68500< / upperWage>

< taxAmt> 3870< / taxAmt>

< taxRate> 0.25< / taxRate>

< / FWT_TAXTABLES>

< / FWT>

" Nicholas Paldino [.NET / C#MVP]"写道:
Here is an example of the file. The file is used to create 3 datatables in
the DataSet, I used the signature information in the first node position and
the last node. This example shows the signature in the first position using
the XmlDocument.DocumentElement.PrependChild() method.

Thanks

<?xml version="1.0" encoding="utf-8"?>
<FWT>
<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>hxyhMOAfdFJYOsDlADHTah0Gmmg=</DigestValue>
</Reference>
</SignedInfo>

<SignatureValue>rakRKha0vAX8cIsFwhJUsgzOB1NMNW6v iG/EsTUivy4Rt3Cg2k1LDTkmJv+bXhgWBoPBtdMxg9ZSXah0P1qw5 K/1npSWPmJ9uWGEQuWwZT5KqJNfq1iy7QKfUiKGTn1q+0Mc2WXPo 18v6Fnuqqh7+btrpfnvbTaKJ0mQHAw9H+0=</SignatureValue>
<KeyInfo>
<KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">
<RSAKeyValue>

<Modulus>01k61JX5bc/jCLnnEHtzw3o08hs6+KjE58md8wkRrBgTTEU3gtmD1Q8SxPxpJ iSwGNRCWTAghxSrK7AFYOCGZTblstnHerqs0Z/LTVNW2JaVkI34kvquqWdd6JJ+GNYWWuKuTiTjyEpLSikjXXFTW kLJqDU/w1Lq6MN6g+z6lx8=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</Signature>
<FWT_CONFIG>
<keyName>#PEREXEMPAMT</keyName>
<keyValue>3100</keyValue>
</FWT_CONFIG>
<FWT_FORMULA>
<Step>1</Step>
<Token>MUL</Token>
<Arg1>@TAXWAGES</Arg1>
<Arg2>@PAYPERIODS</Arg2>
<Arg3>ANNUALWAGE</Arg3>
<Arg4 />
<Arg5 />
<Arg6 />
<Arg7 />
<Arg8 />
<DefValue>0</DefValue>
<Comment />
</FWT_FORMULA>
<FWT_TAXTABLES>
<filingStatus>1</filingStatus>
<taxTableId>3</taxTableId>
<baseWage>9700</baseWage>
<upperWage>30800</upperWage>
<taxAmt>705</taxAmt>
<taxRate>0.15</taxRate>
</FWT_TAXTABLES>
<FWT_TAXTABLES>
<filingStatus>1</filingStatus>
<taxTableId>4</taxTableId>
<baseWage>30800</baseWage>
<upperWage>68500</upperWage>
<taxAmt>3870</taxAmt>
<taxRate>0.25</taxRate>
</FWT_TAXTABLES>
</FWT>
"Nicholas Paldino [.NET/C# MVP]" wrote:
Brian,

你能发一个签名文件的例子吗?

-
- 尼古拉斯Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Brian W. Smith <峰; br ********* @ discussions.microsoft.com>在消息中写道
新闻:26 ********************************** @ microsof t.com。 ..
Brian,

Can you post an example of the signed document?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian W. Smith" <Br*********@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
我有XML文档,我正在进行数字签名,并且需要能够将这些文档加载到DataSet对象中。但是,在检查
签名并使用DataSet.ReadXML方法后,我收到一个异常根目录
元素缺失。

我有在过去24小时内一直在努力寻找解决这个问题的方法,但是我被困住了。我很感激
社区可以为我提供的任何帮助。

谢谢,
I have XML Documents that I am digitally signing, and need to be able to
load
these documents into DataSet objects. However, after checking the
signature
and using the DataSet.ReadXML method, I am getting an exception "The root
element is missing".

I have struggled over the last 24 hours trying to figure out ways of
correcting this, however I am stuck. I would appreciate any help that the
community can provide me on this.

Thanks,




Brian,


我将XML文档保存到文件中,然后将其加载到DataSet

中,没有任何问题。你确定这是正确的文件吗?你怎么用
将它加载到DataSet中?

-

- Nicholas Paldino [。 NET / C#MVP]

- mv*@spam.guard.caspershouse.com

" Brian W. Smith" <峰; br ********* @ discussions.microsoft.com>在消息中写道

新闻:0B ********************************** @ microsof t.com ...
Brian,

I saved that XML document to a file, and then loaded it into a DataSet
without any problems. Are you sure this is the right file, and how are you
loading it into the DataSet?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian W. Smith" <Br*********@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
以下是该文件的示例。该文件用于在DataSet中创建3个数据表,我在第一个节点位置使用签名信息
最后一个节点。此示例使用XmlDocument.DocumentElement.PrependChild()方法显示第一个位置的签名

谢谢

<?xml版本= QUOT; 1.0" encoding =" utf-8"?>
< FWT>
< 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" />
<参考URI ="">
<转换>
<转换
算法=" http://www.w3.org / 2000/09 / XMLDSIG#包膜签名" />
< / Transforms>
< DigestMethod Algorithm =" http://www.w3.org/2000/09/xmldsig#sha1" />
< DigestValue> hxyhMOAfdFJYOsDlADHTah0Gmmg =< / DigestValue>
< /参考>
< / SignedInfo>

< SignatureValue> rakRKha0vAX8cIsFwhJUsgzOB1NMNW6v iG / EsTUivy4Rt3Cg2k1LDTkmJv + bXhgWBoPBtdMxg9ZSXah0P1qw5 K / 1npSWPmJ9uWGEQuWwZT5KqJNfq1iy7QKfUiKGTn1q + 0Mc2WXPo 18v6Fnuqqh7 + btrpfnvbTaKJ0mQHAw9H + 0 =< /&的SignatureValue GT;
<密钥信息>
< KEYVALUE的xmlns = QUOT; HTTP://www.w3.org/2000 / 09 / XMLDSIG#">
< RSAKeyValue>

<模量> 01k61JX5bc / jCLnnEHtzw3o08hs6 + KjE58md8wkRrBgTTEU3gtmD1Q8SxPxpJ iSwGNRCWTAghxSrK7AFYOCGZTblstnHerqs0Z / LTVNW2JaVkI34kvquqWdd6JJ + GNYWWuKuTiTjyEpLSikjXXFTW kLJqDU / w1Lq6MN6g + z6lx8 = LT; /模量>
< Exponent> AQAB< / Exponent>
< / RSAKeyValue>
< / KeyValue>
< / KeyInfo>
< / Signature>
< FWT_CONFIG>
< keyName>#PEREXEMPAMT< / keyName>
< ; keyValue> 3100< / keyValue>
< / FWT_CONFIG>
< / FWT_FORMULA>
<步骤> 1< /步骤>
<令牌> MUL< / Token> ;
< Arg1> @ TAXWAGES< / Arg1>
< Arg2> @ PAYPERIODS< / Arg2>
< Arg3> ANNUALWAGE< / Arg3>
< Arg4 / >
< Arg5 />
< Arg6 />
< Arg7 />
< Arg8 />
< DefValue> 0< / DefValue>
< / / FWT_FORMULA>
< FWT_TAXTABLES>
< filingStatus> 1< / filingStatus>
< ; taxTableId> 3< / taxTableId>
< baseWage> 9700< / baseWage>
< upperWage> 30800< / upperWage>
< taxAmt> 705< / taxAmt>
< taxRate> 0.15< / taxRate>
< / FWT_TAXTABLES>
< FWT_TAXTABLES>
< filingStatus> 1< / filingStatus>
< taxTableId> 4< ; / taxTableId>
< baseWage> 30800< / baseWage>
< upperWage> 68500< / upperWage>
< taxAmt> 3870< / taxAmt>
< taxRate> 0.25< / taxRate>
< / FWT_TAXTABLES>
< / FWT>

" Nicholas Paldino [。NET / C#MVP]"写道:
Here is an example of the file. The file is used to create 3 datatables in
the DataSet, I used the signature information in the first node position
and
the last node. This example shows the signature in the first position
using
the XmlDocument.DocumentElement.PrependChild() method.

Thanks

<?xml version="1.0" encoding="utf-8"?>
<FWT>
<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>hxyhMOAfdFJYOsDlADHTah0Gmmg=</DigestValue>
</Reference>
</SignedInfo>

<SignatureValue>rakRKha0vAX8cIsFwhJUsgzOB1NMNW6v iG/EsTUivy4Rt3Cg2k1LDTkmJv+bXhgWBoPBtdMxg9ZSXah0P1qw5 K/1npSWPmJ9uWGEQuWwZT5KqJNfq1iy7QKfUiKGTn1q+0Mc2WXPo 18v6Fnuqqh7+btrpfnvbTaKJ0mQHAw9H+0=</SignatureValue>
<KeyInfo>
<KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">
<RSAKeyValue>

<Modulus>01k61JX5bc/jCLnnEHtzw3o08hs6+KjE58md8wkRrBgTTEU3gtmD1Q8SxPxpJ iSwGNRCWTAghxSrK7AFYOCGZTblstnHerqs0Z/LTVNW2JaVkI34kvquqWdd6JJ+GNYWWuKuTiTjyEpLSikjXXFTW kLJqDU/w1Lq6MN6g+z6lx8=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</Signature>
<FWT_CONFIG>
<keyName>#PEREXEMPAMT</keyName>
<keyValue>3100</keyValue>
</FWT_CONFIG>
<FWT_FORMULA>
<Step>1</Step>
<Token>MUL</Token>
<Arg1>@TAXWAGES</Arg1>
<Arg2>@PAYPERIODS</Arg2>
<Arg3>ANNUALWAGE</Arg3>
<Arg4 />
<Arg5 />
<Arg6 />
<Arg7 />
<Arg8 />
<DefValue>0</DefValue>
<Comment />
</FWT_FORMULA>
<FWT_TAXTABLES>
<filingStatus>1</filingStatus>
<taxTableId>3</taxTableId>
<baseWage>9700</baseWage>
<upperWage>30800</upperWage>
<taxAmt>705</taxAmt>
<taxRate>0.15</taxRate>
</FWT_TAXTABLES>
<FWT_TAXTABLES>
<filingStatus>1</filingStatus>
<taxTableId>4</taxTableId>
<baseWage>30800</baseWage>
<upperWage>68500</upperWage>
<taxAmt>3870</taxAmt>
<taxRate>0.25</taxRate>
</FWT_TAXTABLES>
</FWT>
"Nicholas Paldino [.NET/C# MVP]" wrote:
Brian,

你能发一个签名文件的例子吗?

-
- 尼古拉斯Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Brian W. Smith <峰; br ********* @ discussions.microsoft.com>在消息中写道
新闻:26 ********************************** @ microsof t.com。 ..
Brian,

Can you post an example of the signed document?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian W. Smith" <Br*********@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
>我有XML文档,我正在进行数字签名,并且需要能够
>加载
>将这些文档转换为DataSet对象。但是,检查完
>签名
>并使用DataSet.ReadXML方法,我得到一个例外
> root
>元素缺失。
>
>在过去的24小时里,我一直在努力寻找
>的方法。纠正这个,但我被卡住了。我将不胜感激任何帮助
>
>社区可以为我提供这个。
>
>谢谢,
>I have XML Documents that I am digitally signing, and need to be able to
>load
> these documents into DataSet objects. However, after checking the
> signature
> and using the DataSet.ReadXML method, I am getting an exception "The
> root
> element is missing".
>
> I have struggled over the last 24 hours trying to figure out ways of
> correcting this, however I am stuck. I would appreciate any help that
> the
> community can provide me on this.
>
> Thanks,




这篇关于无法从签名的XML文档创建数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆