Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: Help using libcurl with HTTP proxy on Android device
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 13 Apr 2023 14:30:09 +0200
Great that you got it to work "the proper way".
/hh
Den tors 13 apr. 2023 03:12David Castillo via curl-library <
curl-library_at_lists.haxx.se> skrev:
> Okay, I think I have a solution that can work for me :) I used the
> https://curl.se/libcurl/c/CURLOPT_SSL_CTX_FUNCTION.html callback and I'm
> reading the der file and adding it to the store, similar to the example in
> the docs. It's something like this:
>
> static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) {
> X509_STORE *store;
> X509 *cert = NULL;
> FILE *derCert = fopen("/data/misc/user/0/cacerts-added/924c6f19.0",
> "r");
>
> // Create cert from file
> cert = d2i_X509_fp(derCert, NULL);
> if(cert == NULL)
> printf("d2i_X509_fp failed...\n");
>
> /* get a pointer to the X509 certificate store (which may be empty) */
> store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx);
>
> /* add our certificate to this store */
> if(X509_STORE_add_cert(store, cert) == 0)
> printf("error adding certificate\n");
>
> /* decrease reference counts */
> X509_free(cert);
>
> /* all set to go */
> return CURLE_OK;
> }
>
> Thanks all for your help!! I'm not sure if the thread needs to be marked
> as solved or anything.
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>
Date: Thu, 13 Apr 2023 14:30:09 +0200
Great that you got it to work "the proper way".
/hh
Den tors 13 apr. 2023 03:12David Castillo via curl-library <
curl-library_at_lists.haxx.se> skrev:
> Okay, I think I have a solution that can work for me :) I used the
> https://curl.se/libcurl/c/CURLOPT_SSL_CTX_FUNCTION.html callback and I'm
> reading the der file and adding it to the store, similar to the example in
> the docs. It's something like this:
>
> static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) {
> X509_STORE *store;
> X509 *cert = NULL;
> FILE *derCert = fopen("/data/misc/user/0/cacerts-added/924c6f19.0",
> "r");
>
> // Create cert from file
> cert = d2i_X509_fp(derCert, NULL);
> if(cert == NULL)
> printf("d2i_X509_fp failed...\n");
>
> /* get a pointer to the X509 certificate store (which may be empty) */
> store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx);
>
> /* add our certificate to this store */
> if(X509_STORE_add_cert(store, cert) == 0)
> printf("error adding certificate\n");
>
> /* decrease reference counts */
> X509_free(cert);
>
> /* all set to go */
> return CURLE_OK;
> }
>
> Thanks all for your help!! I'm not sure if the thread needs to be marked
> as solved or anything.
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2023-04-13