简体   繁体   中英

RSA encryption - How to encrypt to smaller size than key

I use RSA encryption in my project, and I need to encrypt array of bytes to encrypted array of bytes, that his length is smaller than the key length (I use 2048 bit key). When I use the RSACryptoServiceProvider class with c# it always encrypt it to an array of bytes that his length is the key length (256 bytes). I know I cannot encrypt it to a longer size than the key, but, can I encrypt it to a smaller one (to the originial non-encrypted array of bytes length)?

不能。在进行加密之前,必须对明文填充密钥大小,以防止某些类型的密码分析攻击,因此,对于RSA实现( 尤其是那些打算用于一般用途的实现),忽略它没有意义的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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