如何在vb.net中的xml文件的选定字段上创建数字签名 [英] How to create a digital signature on selected fields of xml file in vb.net

查看:82
本文介绍了如何在vb.net中的xml文件的选定字段上创建数字签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vb.net中的xml文件的选定字段上创建数字签名

How to create a digital signature on selected fields of xml file in vb.net

推荐答案

我认为您可以通过数字方式介绍自己的机制签署单独的字段(XML节点?属性?)。该机制基于开放密钥加密你应该学习和理解:

http://en.wikipedia.org/wiki/Public-key_cryptography [ ^ ],

http://en.wikipedia.org / wiki / Digital_signature [ ^ ]。



对于密钥生成和分发所需的代码,公钥加密,解密和使用签名检查数据真实性,您可以使用提供的算法之一由.NET FCL派生,派生自抽象类 System.Security.Cryptography.AsymmetricAlgorithm

HTTP: //msdn.microsoft.com/en-us/library/system.security.cryptography.asymmetricalgorithm.aspx [ ^ ]。



我的一个重要建议是:要强制执行您的机制,请使用 XML架构,这需要使用签名 强制 检查字段,并始终验证此架构。如果您不关心它,可以通过简单地跳过所需的元素或属性来创建伪造的XML。请参阅:

http://en.wikipedia.org/wiki/XML_schema [< a href =http://en.wikipedia.org/wiki/XML_schematarget =_ blanktitle =New Window> ^ ],

http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschema .aspx [ ^ ],

http ://msdn.microsoft.com/en-us/library/aa310911%28v=vs.71%29.aspx [ ^ ]。



这个CodeProject文章也很有用:简单代码验证XML文件模式文件(XSD) [ ^ ]。



-SA
I think all you can do it to introduce your own mechanism for digitally signing of separate "fields" (XML nodes? attributes?). The mechanism is based on open-key cryptography you should learn and understand well:
http://en.wikipedia.org/wiki/Public-key_cryptography[^],
http://en.wikipedia.org/wiki/Digital_signature[^].

As to the code needed for key generation and distribution, public-key encryption, decryption and check-up of the data authenticity using the signatures, you can use one of the algorithms provided by the .NET FCL, derived from the abstract class System.Security.Cryptography.AsymmetricAlgorithm:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.asymmetricalgorithm.aspx[^].

One important advice I have is: to enforce your mechanism, use XML schema which makes the "fields" you need to check with the signatures mandatory and always validate this schema. If you don't take care about it, the counterfeit XML can be created by simply skipping the required elements or attributes. Please see:
http://en.wikipedia.org/wiki/XML_schema[^],
http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschema.aspx[^],
http://msdn.microsoft.com/en-us/library/aa310911%28v=vs.71%29.aspx[^].

This CodeProject article can also be useful: Simple code to validate an XML file against a schema file (XSD)[^].

—SA


这篇关于如何在vb.net中的xml文件的选定字段上创建数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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