私は openssl を使用してアプリケーションを開発していますが、基本的に、ユーザーが選択した場合にリモート証明書をストアに追加する方法を見つける必要があります。私はopensslを初めて使用しますが、これが証明書を追加するロジックを配置する場所であると確信しています:
if(SSL_get_verify_result(ssl) != X509_V_OK) {
printf("Certificate did not validate.\nDo you wish to add this certificate to the trust certificate store?(yes/no)\n");
char response[3];
while(1) {
scanf("%s", response);
if(strcmp(response, "yes") == 0) {
/* Add the certificate */
break;
}
else if(strcmp(response, "no") == 0) {
BIO_free_all(bio);
SSL_CTX_free(ctx);
return 0;
}
else {
printf("yes or no, please.\n");
}
}
}
私はopensslのドキュメントを試しましたが、非常に面倒で、そこに詳細を見つけるのは難しいことがわかりました. どんな助けでも大歓迎です。