简体   繁体   English

RSA加密C#

[英]RSA Encryption C#

I have a class which in C# doing RSA encryption where I used the default RSACryptoServiceProvider class. 我有一个在C#中进行RSA加密的类,我使用默认的RSACryptoServiceProvider类。 But I have a concern regarding the following; 但我对以下问题表示担忧; If you have the word hello for an input and the encrypted string is returned as ABCDE, if you perform another encrypt operation on the input hello, using the same keys (public and private) for the RSA will the output be again ABCDE? 如果您输入了单词hello并且加密的字符串作为ABCDE返回,如果您对输入问候语执行另一个加密操作,使用RSA的相同键(公共和私有)将输出再次为ABCDE?

Thanks in advance 提前致谢

Indeed, RSA is a deterministic encryption algorithm, so given the same keys and plaintext, the same cryptotext will be outputted. 实际上,RSA是确定性加密算法,因此给定相同的密钥和明文,将输出相同的密码文本。 RSA is commonly used with a padding scheme to be semantically secure. RSA通常与填充方案一起使用以在语义上安全。

This is of course only the general case. 这当然只是一般情况。 I can't vouch for the RSACryptoServiceProvider in C# 我不能保证在C#中使用RSACryptoServiceProvider

Edit: 编辑:

Of course, your chosen padding scheme needs to be pretty pseudorandom as well. 当然,您选择的填充方案也需要非常伪随机。 OAEP is one commonly used. OAEP是常用的一种。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM