Hi I'm trying to use libssl to get some EMSA_PSS_ENCODING through the function RSA_padding_add_PKCS1_type1 in libssl, but I can't find nor docs nor solutions, so this is the example code I've written:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/rsa.h>
#include <openssl/err.h>
FILE *error_file;
int main()
{
int lSize;
const unsigned char *string1= (unsigned char *)"The pen is on the table";
unsigned char *stringa=NULL;
int num = 64;
if ((stringa = (unsigned char *)OPENSSL_malloc(num)) == NULL)
fprintf(stderr,"OPENSSL_malloc error\n");
lSize = strlen((char *)string1);
fprintf(stdout,"string1 len is %u\n",lSize);
if(RSA_padding_add_PKCS1_type_1(stringa,num,string1,lSize) != 1)
fprintf(stderr,"Error: RSA_PADDING error\n");
error_file = fopen("libssl.log", "w");
ERR_print_errors_fp(error_file);
fclose(error_file);
fprintf(stdout,(char *)stringa);
fprintf(stdout,"\n");
}
The problem is that I get no output in stringa, I think the function RSA_padding_add.. should be initialized, but I can't find how to do it in the few doc at the openssl site.
Thanks