码迷,mamicode.com
首页 > 其他好文 > 详细

RSA_size的使用

时间:2017-09-25 13:24:47      阅读:868      评论:0      收藏:0      [点我收藏+]

标签:use   lan   int   ted   add   ops   概率   size   随机   

RSA密钥长度、明文长度和密文长度

调用Openssl库中的RSA_public_encrypt函数成功的概率随机,是什么原因?

 

NAME
       RSA_size - get RSA modulus size

SYNOPSIS
        #include <openssl/rsa.h>

        int RSA_size(const RSA *rsa);

DESCRIPTION
       This function returns the RSA modulus size in bytes. It can be used to determine how much memory must be allocated for an RSA encrypted value.

       rsa->n must not be NULL.

  

注意:

1、这个函数是获取rsa模数的大小。

2、当使用RSA_public_encrypt加密时,加密后的数据长度和模数的大小相同

3、加密时当采用RSA_PKCS1_PADDING补齐时,明文长度<=RSA_size(rsa)-11

4、当加密出现错误并使用ERR_get_error()得到error:0406D06E:lib(4):func(109):reason(110)错误时,表明明文的长度太长

aa

RSA_size的使用

标签:use   lan   int   ted   add   ops   概率   size   随机   

原文地址:http://www.cnblogs.com/jingzhishen/p/7591250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!