开发者

.NET Public Private Key Based Encryption

开发者 https://www.devze.com 2023-01-23 00:50 出处:网络
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

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?

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

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

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.

Can you pleas开发者_StackOverflowe help how to over come above situation where i do not have to send enrypting key information along with decryption key

Please help

Thanks


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

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.

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.


Looks like you want to sign your data and not encrypt it.

0

精彩评论

暂无评论...
验证码 换一张
取 消