首页
社区
课程
招聘
[求助] XML文件代码
发表于: 2013-2-25 04:53 4142

[求助] XML文件代码

2013-2-25 04:53
4142
加密的大致流程如下:
1.     通过从磁盘加载 XML 文件创建 XmlDocument 对象。XmlDocument 对象包含要加密的 XML 元素。
2.     在 XmlDocument 对象中找到指定的元素,然后创建一个新的 XmlElement 对象来表示要加密的元素。
3.     创建 EncryptedXml 类的新实例,并使用它通过指定的加密算法对 XmlElement 进行加密。
4.     构造一个 EncryptedData 对象,用XML 加密元素的 URL 标识符、EncryptedKey信息等填充它,并将加密数据填充到该结构体里面去。(很重要,很繁琐的步骤)
5.     用 EncryptedData 元素替换原始 XmlDocument 对象中的元素。
我们直接拿test.xml来加密,要加密的元素是<number>,加密粒度是该结点,加密数据采用最简单的DES加密,加密后的XML文档变为:
[xhtml] view plaincopy
<root>  
  <creditcard>  
    <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">  
      <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#des-cbc" />  
      <CipherData>  
        <CipherValue>3oIDgOJMW0/Ev3duGiCvsVdDgPzP7X0399xwVKMR8MQUGO1AMTIlFA==</CipherValue>  
      </CipherData>  
    </EncryptedData>  
    <expiry>02/02/2002</expiry>  
  </creditcard>  
</root>  

从该加密后的XML里面可以看得出来,<EncryptedData>这个节点里面的内容为加密后的核心内容,但这里面真正被加密的内容在哪?很明显,<CipherValue>中3oIDgOJMW0/Ev3duGiCvsVdDgPzP7X0399xwVKMR8MQUGO1AMTIlFA==这一长串就是加密后的真正数据。那其它部分都是些什么内容?这里,我们需要熟悉一下W3C关于加密的标准。可参见XML Encryption Syntax and Processing文档。

按照上面的理解方式,问题如下
  <?xml version="1.0" ?>
- <MF>
  <AdminPin>123456781234567812345678</AdminPin>
  <UserPin>未来房价</UserPin>
  <CanDown>1</CanDown>
  <AuthenPin />
  <Sense4Type>2.3版 单机版 32K</Sense4Type>
  <MFLicense />
- <EF>
  <ID>FF00</ID>
  <Type>EXE</Type>
  <ReadWrite />
  <Source>C:\11\FF00.bin</Source>
  <Length>02D6</Length>
  <Content>0202C2AFC198F9FD06CE9C3EE503E05E977F5311A659E7B0E12E51ED807E7B1CADA82102F091D34927FBE948D8BF2EF8078F1D7247DB1455186D013A9E784E4CC065406244385FF42A9BBDE8E3EA99A9EFCD17BABBACEB2CDC25318396F504701BB643B49376BCCFD533348E5C90898DA524C24692578410771AF7084AD4325B8AAE1F392F23FA373B35676FEC86D6D0C99F683DD2B8DE4DE27CD9C69D5263C31342A0A2AB3069E62E287A64582E1E9A20663654CBFC87A7DAAA12742EC41622A4A3B3C72B15C58873812DDDCC8BB2194B4571B5C8FFF6B1050FBE756AA1D794564F50F38C29B73F7DEE0E850B6C796EE4F226615DD1F12E82413C95DFFE6BCAB95A60E709F608DFFA8046E709F208DFFA803E88828C83E709F0A3DFFA8032E309F608DFFA8078E309F208DFFA807088828C83E309F0A3DFFA806489828A83E0A3F608DFFA805889828A83E0A3F208DFFA804C80D280FA80C680D4806980F28033801080A680EA809A80A880DA80E280CA803389828A83ECFAE493A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFE9DEE7800D89828A83E493A3F608DFF9ECFAA9F0EDFB2289828A83ECFAE0A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFEADEE880DB89828A83E493A3F208DFF980CC88F0EF60010E4E60C388F0ED2402B4040050B9F582EB2402B4040050AF23234582239001537378007C007D017BFF7A0079037E007F201201D378207C007D017BFF7A0079237E007F201201D378407C007D017BFF7A0079437E007F201201D378607C007D017BFF7A0079637E007F201201D378807C007D017BFF7A0079837E007F201201D378A07C007D017BFF7A0079A37E007F201201D378C07C007D017BFF7A0079C37E007F201201D378E07C007D017BFF7A0079E37E007F201201D39002017401F0A37408F0A37401F09002057405F0E4A3F0A3F0A3F0A3F0A3F0A3F0A3F07B017A0279057F081202D20202CE787FE4F6D8FD7581070201F912FF002212FF0222</Content>
  <RsaID />
  <CreateMode>导入</CreateMode>
  </EF>
- <EF>
  <ID>0002</ID>
  <Type>EXE</Type>
  <ReadWrite />
  <Source>C:\11\0002.bin</Source>
  <Length>06CE</Length>
  <Content>0206B078007C007D017BFF7A05795C7E007F201204F078207C007D017BFF7A05797C7E007F201204F078407C007D017BFF7A05799C7E007F201204F078607C007D017BFF7A0579BC7E007F201204F078807C007D017BFF7A0579DC7E007F201204F078A07C007D017BFF7A0579FC7E007F201204F078C07C007D017BFF7A06791C7E007F201204F078E07C007D017BFF7A06793C7E007F201204F09002017401F0A37408F0A37401F0E4900205F0A3F0A3F0A37405F0E4A3F0A3F0A3F0A3F0900204E0FFC394FF501474052FF582E43402F583E4F0900204E004F080E27B017A0179007488FFFE1206BC900201E0FBA3E0FAA3E0F912051664027054900100E0FF90000312052FFD7C0090000412052FFBC003900201E0FBA3E0A3E02405F9E43AFA900315EBF0A3EAF0A3E9F0D003120686900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F912051664037044900100E0FF90000312052FFD7C0090000412052FFB9003157401F0A37402F0A37405F012065C900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900800E0640A703C900201E0FBA3E0FAA3E0F990000112052FFFB402277B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900800E064066003020333900201E0FBA3E0FAA3E0F990000112052FFF6420600302033390000212052FB4040C7B017A0079001206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4031390000112052FFF7B017A0079201206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4011390000112052FFF7B017A0079401206CA1206C6900201E0FBA3E0FAA3E0F990000212052F701390000112052FFF7B017A0079601206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4071390000112052FFF7B017A0079801206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4061390000112052FFF7B017A0079A01206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4051390000112052FFF7B017A0079C01206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4021390000112052FFF7B017A0079E01206CA1206C6900201E0FBA3E0FAA3E0F9120516B41918E4900205F090000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F9120516B408199002057408F090000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F91205166413702E90000112052FFF7B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F990000112052FFFB410277B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA0206C6E709F608DFFA8046E709F208DFFA803E88828C83E709F0A3DFFA8032E309F608DFFA8078E309F208DFFA807088828C83E309F0A3DFFA806489828A83E0A3F608DFFA805889828A83E0A3F208DFFA804C80D280FA80C680D4806980F28033801080A680EA809A80A880DA80E280CA803389828A83ECFAE493A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFE9DEE7800D89828A83E493A3F608DFF9ECFAA9F0EDFB2289828A83ECFAE0A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFEADEE880DB89828A83E493A3F208DFF980CC88F0EF60010E4E60C388F0ED2402B4040050B9F582EB2402B4040050AF232345822390047073BB010689828A83E0225002E722BBFE02E32289828A83E49322BB010CE58229F582E5833AF583E0225006E92582F8E622BBFE06E92582F8E222E58229F582E5833AF583E49322AFC198F9FD06CE9C3EE503E05E977F5311A659E7B0E12E51ED807E7B1CADA82102F091D34927FBE948D8BF2EF8078F1D7247DB1455186D013A9E784E4CC065406244385FF42A9BBDE8E3EA99A9EFCD17BABBACEB2CDC25318396F504701BB643B49376BCCFD533348E5C90898DA524C24692578410771AF7084AD4325B8AAE1F392F23FA373B35676FEC86D6D0C99F683DD2B8DE4DE27CD9C69D5263C31342A0A2AB3069E62E287A64582E1E9A20663654CBFC87A7DAAA12742EC41622A4A3B3C72B15C58873812DDDCC8BB2194B4571B5C8FFF6B1050FBE756AA1D794564F50F38C29B73F7DEE0E850B6C796EE4F226615DD1F12E82413C95DFFE6BCAB95A60900312ECF0A3EDF0A3EBF012FF8C900314E0FF900312E0FCA3E0FD900315E0FBA3E0FAA3E0F912FF0622900312ECF0A3EDF0A3EBF012FF8C900314E0FF900312E0FCA3E0FD900315E0FBA3E0FAA3E0F912FF0822787FE4F6D8FD758107020003E4FD12FF042212FF282212FF002212FF0222</Content>
  <RsaID />
  <CreateMode>导入</CreateMode>
  </EF>
- <EF>
  <ID>0004</ID>
  <Type>EXE</Type>
  <ReadWrite />
  <Source>C:\11\0002.bin</Source>
  <Length>06CE</Length>
  <Content>0206B078007C007D017BFF7A05795C7E007F201204F078207C007D017BFF7A05797C7E007F201204F078407C007D017BFF7A05799C7E007F201204F078607C007D017BFF7A0579BC7E007F201204F078807C007D017BFF7A0579DC7E007F201204F078A07C007D017BFF7A0579FC7E007F201204F078C07C007D017BFF7A06791C7E007F201204F078E07C007D017BFF7A06793C7E007F201204F09002017401F0A37408F0A37401F0E4900205F0A3F0A3F0A37405F0E4A3F0A3F0A3F0A3F0900204E0FFC394FF501474052FF582E43402F583E4F0900204E004F080E27B017A0179007488FFFE1206BC900201E0FBA3E0FAA3E0F912051664027054900100E0FF90000312052FFD7C0090000412052FFBC003900201E0FBA3E0A3E02405F9E43AFA900315EBF0A3EAF0A3E9F0D003120686900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F912051664037044900100E0FF90000312052FFD7C0090000412052FFB9003157401F0A37402F0A37405F012065C900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900800E0640A703C900201E0FBA3E0FAA3E0F990000112052FFFB402277B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900800E064066003020333900201E0FBA3E0FAA3E0F990000112052FFF6420600302033390000212052FB4040C7B017A0079001206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4031390000112052FFF7B017A0079201206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4011390000112052FFF7B017A0079401206CA1206C6900201E0FBA3E0FAA3E0F990000212052F701390000112052FFF7B017A0079601206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4071390000112052FFF7B017A0079801206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4061390000112052FFF7B017A0079A01206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4051390000112052FFF7B017A0079C01206CA1206C6900201E0FBA3E0FAA3E0F990000212052FB4021390000112052FFF7B017A0079E01206CA1206C6900201E0FBA3E0FAA3E0F9120516B41918E4900205F090000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F9120516B408199002057408F090000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F91205166413702E90000112052FFF7B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F990000112052FFFB410277B017A0279051206C2900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA1206C6900201E0FBA3E0FAA3E0F990000112052FFF7B017A0279051206CA0206C6E709F608DFFA8046E709F208DFFA803E88828C83E709F0A3DFFA8032E309F608DFFA8078E309F208DFFA807088828C83E309F0A3DFFA806489828A83E0A3F608DFFA805889828A83E0A3F208DFFA804C80D280FA80C680D4806980F28033801080A680EA809A80A880DA80E280CA803389828A83ECFAE493A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFE9DEE7800D89828A83E493A3F608DFF9ECFAA9F0EDFB2289828A83ECFAE0A3C8C582C8CCC583CCF0A3C8C582C8CCC583CCDFEADEE880DB89828A83E493A3F208DFF980CC88F0EF60010E4E60C388F0ED2402B4040050B9F582EB2402B4040050AF232345822390047073BB010689828A83E0225002E722BBFE02E32289828A83E49322BB010CE58229F582E5833AF583E0225006E92582F8E622BBFE06E92582F8E222E58229F582E5833AF583E49322AFC198F9FD06CE9C3EE503E05E977F5311A659E7B0E12E51ED807E7B1CADA82102F091D34927FBE948D8BF2EF8078F1D7247DB1455186D013A9E784E4CC065406244385FF42A9BBDE8E3EA99A9EFCD17BABBACEB2CDC25318396F504701BB643B49376BCCFD533348E5C90898DA524C24692578410771AF7084AD4325B8AAE1F392F23FA373B35676FEC86D6D0C99F683DD2B8DE4DE27CD9C69D5263C31342A0A2AB3069E62E287A64582E1E9A20663654CBFC87A7DAAA12742EC41622A4A3B3C72B15C58873812DDDCC8BB2194B4571B5C8FFF6B1050FBE756AA1D794564F50F38C29B73F7DEE0E850B6C796EE4F226615DD1F12E82413C95DFFE6BCAB95A60900312ECF0A3EDF0A3EBF012FF8C900314E0FF900312E0FCA3E0FD900315E0FBA3E0FAA3E0F912FF0622900312ECF0A3EDF0A3EBF012FF8C900314E0FF900312E0FCA3E0FD900315E0FBA3E0FAA3E0F912FF0822787FE4F6D8FD758107020003E4FD12FF042212FF282212FF002212FF0222</Content>
  <RsaID />
  <CreateMode>导入</CreateMode>
  </EF>
- <EF>
  <ID>A001</ID>
  <Type>EXE</Type>
  <ReadWrite />
  <Source>C:\11\A001.bin</Source>
  <Length>02D2</Length>
  <Content>0202BE90000F7401F0A37408F0A37401F0F9A3C9F0A37408F0A3E9F090000FE0FBA3E0FAA3E0F97D0412024A90000FE0FBA3E0FAA3E0F91201EA90011512020A900115E0FCA3E0FDA3E0FEA3E064C1FFEE645FFEED6434FDEC6438FC90011512020A900115E0FCA3E0FDA3E0FEA3E0FF78041201C490011512020A900115E0FCA3E0FDA3E0FEA3E0247AFFEE346AFEED34B7FDEC34ECFC90011512020A900115E0FCA3E0FDA3E0FEA3E0FF78011201D790011512020A900115E0FCA3E0FDA3E0FEA3E04409FFEE4482FEED4457FDEC4432FC90011512020A900115E0FCA3E0FDA3E0FEA3E0FF78021201C490011512020A900115E0FCA3E0FDA3E0FEA3E06413FFEE6432FEED649FFDEC6498FC90011512020A900115E0FCA3E0FDA3E0FEA3E04409FFEE4482FEED4457FDEC4432FC90011512020A900115E0FCA3E0FDA3E0FEA3E0FF78011201D790011512020A900115E0FCA3E0FDA3E0FEA3E02442FFEE3423FEED3434FDEC3432FC90011512020A900115E0FCA3E0FDA3E0FEA3E05435FFEE5427FEED5431FDEC5422FC90011512020A900115E0FCA3E0FDA3E0FEA3E0FF78021201D790011512020A7B017A0179157D0412024A7B017A0179157F041202CE0202CAE8600FECC313FCED13FDEE13FEEF13FFD8F122E8600FEFC333FFEE33FEED33FDEC33FCD8F122BB010789828A830202225005E9F8020216BBFE05E9F802022E89828A8302023AECF0A3EDF0A3EEF0A3EFF022E6FC08E6FD08E6FE08E6FF22E0FCA3E0FDA3E0FEA3E0FF22E2FC08E2FD08E2FE08E2FF22E493FC740193FD740293FE740393FF227F00ED24FE506CEB14601D046008046060046048805BED1429F8ED03547FFDE7C6F70918DDF9804BED1429FBEA3400FCED03547FFD89828A83E0C88B828C83E0C8F089828A83C8F0E92401F9EA3400FAEB24FFFBEC34FFFCDDDB8017ED1429F8ED03547FFDE3FAE2F3EAF20918DDF680027F0422787FE4F6D8FD75810702000312FF002212FF0222</Content>
  <RsaID />
  <CreateMode>导入</CreateMode>
  </EF>
- <EF>
  <ID>8888</ID>
  <Type>DAT</Type>
  <ReadWrite />
  <Source>C:\11\88881.dat</Source>
  <Length>00C2</Length>
  <Content>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000704030901000D0100000000000000000000000000000000000000000004030601020000000000000006080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Content>
  <RsaID />
  <CreateMode>导入</CreateMode>
  </EF>
  </MF>
上面讲到<EncryptedData>这个节点里面的内容为加密后的核心内容
下面加密后的核心内容在哪里?请教牛人。谢谢

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 10
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
最近很头疼。。。常用的狗里出了一种仿的深思4智能狗,可能软件上的复制了,狗内写成了计算结果与正版狗一模一样的算法,想破这个。。呵呵
2013-2-25 05:05
0
游客
登录 | 注册 方可回帖
返回
//