|
这是打log的代码:
int au_rsa_encrypt(AU_RSA * pubkey, char * src, int src_len, char * dst, int dst_len)
{
int rc = -1;
int elen = -1, i = -1, offset = 0;
int count = 0, remain = 0;
char* cipper = NULL;
unsigned char* from = NULL;
unsigned char* to = NULL;
size_t reserveSize = 0;
printf("au_rsa_encrypt src=, %s\n", src);
printf("au_rsa_encrypt src_len=, %d\n", src_len);
printf("au_rsa_encrypt dst=, %s\n", dst);
printf("au_rsa_encrypt dst_len=, %d\n", dst_len);
int RSA_LEN = RSA_size((RSA*)pubkey); // 512 = 4096 / 8
int FLEN_MAX = RSA_LEN - RSA_PKCS1_PADDING_SIZE;
printf("au_rsa_encrypt RSA_LEN=, %d\n", RSA_LEN);
printf("au_rsa_encrypt RSA_PKCS1_PADDING_SIZE=, %d\n", RSA_PKCS1_PADDING_SIZE);
if (FLEN_MAX <= 0) {
printf("FLEN_MAX <= 0, %d\n", FLEN_MAX);
rc = -1;
goto out_label;
}
输出的log:
0xefd366c0
moKxoSB&qUorj0#GbxQV6xBF#96sb@
30
au_rsa_encrypt src=, moKxoSB&qUorj0#GbxQV6xBF#96sb@
au_rsa_encrypt src_len=, 30
au_rsa_encrypt dst=,
au_rsa_encrypt dst_len=, 512
au_rsa_encrypt RSA_LEN=, 9
au_rsa_encrypt RSA_PKCS1_PADDING_SIZE=, 11
FLEN_MAX <= 0, -2
au_rsa_encrypt success -1
加密失败。 |
|