こんにちは、libssl の関数 RSA_padding_add_PKCS1_type1 を介して EMSA_PSS_ENCODING を取得するために libssl を使用しようとしていますが、ドキュメントも解決策も見つからないため、これは私が書いたサンプル コードです。
#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");
}
問題は、stringa で出力が得られないことです。関数 RSA_padding_add.. を初期化する必要があると思いますが、openssl サイトのいくつかのドキュメントでそれを行う方法が見つかりません。
ありがとう