基于.NET公私密钥加密 [英] .NET Public Private Key Based Encryption

查看:115
本文介绍了基于.NET公私密钥加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用我的公钥/私钥加密一些信息,并允许对方(用户)只DECRYPT我加密。我不希望他们能够知道我怎么加密我的消息。它是如何可能在.NET中使用公共和私有密钥对?

I need to encrypt some info using my Public/Private key, and allow the other party(users) to ONLY DECRYPT what I encrypted. I don't want them to be able to know how I encrypted my message. How it is possible in .NET using public and private key pair?

我试过的RSACryptoServiceProvider。NET中,但问题是

I tried RSACryptoServiceProvider in .NET but the issue with that is

我),我们只能加密使用公开密钥和解密使用私钥 二)私钥XML字符串总是包含公钥XML字符串。

i) We can only encrypt using Public key and decrypt using Private key ii) Private key xml string always contains public key xml string.

所以,如果我使用RSA比我分发与公钥谁需要解密我的消息的用户私钥。

So if i use RSA than i have to distribute Private key along with public key to the users who needs to decrypt my message.

你能帮如何通过上面来情况下我没有送与解密密钥enrypting关键信息

Can you please help how to over come above situation where i do not have to send enrypting key information along with decryption key

请帮忙

感谢

推荐答案

正在正确使用的RSACryptoServiceProvider这一点,但我不明白你的问题。

You are right using the RSACryptoServiceProvider for this, but I don’t understand your problem.

如果您使用的RSACryptoServiceProvider你做完整的密钥(公钥和私钥)和一个客户端解密的密钥的唯一的公共部分服务器端加密。所以,你必须发布关键的唯一的公共部分。这是你想要的,这就是它的工作方式。

If you use the RSACryptoServiceProvider you do a server-side encryption with the complete key (public and private) and a client-side decryption with only the public part of the key. So you have to publish only the public part of the key. That is what you want and that's the way it works.

在另一方面:你怎么描述它在你的问题的方式,是行不通的。你不能只用公钥加密!也有一些是错误在你的问题和/或code。

On the other hand: The way you describe it in your question, wouldn’t work. You can’t encrypt with just the public key! There is something wrong in your question and/or your code.

这篇关于基于.NET公私密钥加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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