RSA 加密长度计算公式
2014-10-24 14:14
232 查看
The length of data that can be encrypted using RSA is determined primarily by the size of the key you're using. You appear to be using OAEP, so the maximum length is:
Where
And since you're using OAEP with SHA-1
So the maximum you can encrypt is:
Which is exactly what your example shows.
To encrypt more data, you could use a larger RSA key, but RSA really shouldn't be used for encrypting large amounts of data, so is usually used as part of a hybrid cryptosystem where RSA is instead used to encrypt a randomly generated key for a symmetric algorithm like AES, and then the symmetric algorithm is used to encrypt the actual data so avoiding the length limits associated with RSA.
keyLength - 2 - 2 * hashLength
Where
keyLengthis the length of the RSA modulus in bytes. You're using a 1024 bit key so:
keyLength = 1024 / 8 = 128
And since you're using OAEP with SHA-1
hashLength = 20
So the maximum you can encrypt is:
128 - 2 - 2 * 20 = 86
Which is exactly what your example shows.
To encrypt more data, you could use a larger RSA key, but RSA really shouldn't be used for encrypting large amounts of data, so is usually used as part of a hybrid cryptosystem where RSA is instead used to encrypt a randomly generated key for a symmetric algorithm like AES, and then the symmetric algorithm is used to encrypt the actual data so avoiding the length limits associated with RSA.
相关文章推荐
- JAVA利用RSA加密算法的长度限制问题解决方案注意: RSA加密明文最大长度117字节,解密要求密文最大长度为128字节,所以在加密和解密的过程中需要分块进行。 RSA加密对明文的长度是有限制的,如
- 量子计算的能够破解RSA加密吗?
- list滚动条Scroll 偏移和长度计算公式总结
- C#使用RSA证书文件加密和解密示例(任意长度的内容)
- RSA加密,不受字节长度限制
- QQ空间操作抓包【MD5-RSA加密】【qqtoken计算】等
- bitmap位图数据长度计算公式
- RSA 加密计算
- 记一次30位密钥长度RSA加密破解过程
- QQ空间操作抓包【MD5-RSA加密】【qqtoken计算】等
- RSA加密解密 错误:Base-64 字符数组的无效长度
- RSA不限长度非对称加密解密C#
- 综合布线网线长度的计算公式
- C#中另类自定义公式计算 字符串转换为计算公式,并得出计算结果【转载】
- 不同手机根据坐标计算控件、图片的像素,px 与 dp, sp换算公式?
- Python 和 java的 RSA加密解密
- 音频中文件大小计算公式(转)
- java使用RSA加密方式实现数据加密解密
- 使用Pear的RPN库处理工资计算公式
- 解析iPhone应用销量趋势的计算公式