English 中文(简体)
确保您签名的 XML 由您签名
原标题:Make sure your signed XML is signed by you

我想签署我所创建的XML文件,

http://msdn.microsoft.com/en-us/library/ms229950.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms229745.aspx

我也读过这份关于核实文件的教程:

http://msdn.microsoft.com/en-us/library/ms229950.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms229950.aspx

但我不明白的是,我是如何用这个来制作XML的, 保证它不会被伪造而不是被伪造的。

我的想法(是错误的,需要纠正 ) : 我做了个XML, 并用这些教义的代码来签名。 我还可以用该代码来验证它。 没有问题, 当我修改XML时它会起作用和检测。 但为什么其他人不能直接从教义中提取代码, 自己制作XML, 然后自己签名, 然后在我的程序中使用它呢? 验证程序是否仍然能验证它?

最佳回答

教学中使用"http://en.wikipedia.org/wiki/RSA28algorithm%29" rel=“nofollow”>RSA 签名密钥:

signedXml.SigningKey = Key;

这 < a href=>"""http://msdn.microsoft.com/en-us/library/ms229745.aspx" rel="nofollow" >link 说:

Generate an asymmetric key using the RSACryptoServiceProvider class. The key is automatically saved to the key container when you pass the CspParameters object to the constructor of the RSACryptoServiceProvider class.

当您运行此示例并将其存储在本地机器上的密钥中时,创建了新的RSA 键。 RSA 键包含一个签名的 < em> 私人密钥 和一个验证签名的 < em> 公用密钥 。 < em> 公用密钥 可以分发给需要验证您签名信件的任何人。 < em> 公用密钥s 通常使用 < a href=> 来包装和分发 http:// en.wikipedia. org/wiki/X509_ certificate' rel= "nofolve" > 证书

假设只有你拥有私人密钥 < / em >,接受者拥有公用密钥 < / em > (且假定执行是安全的),任何人不得在未发现篡改前篡改经签署的文件。

使用同一样本的其他人应生成一个新的独特的RSA密钥,该密钥不能用于签署您的“它们”公用密钥

问题回答

您需要了解两部分背景信息, 才能理解这些教程为何有效。

一旦你读了这些文章 看看这个图表:

Digital Signature Diagram Diagram taken from wikipedia (specifically, here)

两个链接都指显示验证的条款。读取对称键是如何工作的,您将从中受益。当您在 XML 上签名时,您会用您的私人密钥签名,只有您可以进入该密钥,并且只有您可以解密的公用密钥。除了您的个人密钥之外,没有人会拥有您的私人密钥。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签