curl / Mailing Lists / curl-users / Single Mail
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: Error 58 with CURLOPT_SSLCERT

From: Praveen Pvs via curl-users <curl-users_at_cool.haxx.se>
Date: Fri, 21 Jun 2019 00:42:42 +0530

On Fri, Jun 21, 2019 at 12:28 AM toby via curl-users <
curl-users_at_cool.haxx.se> wrote:

>
> this might help you - permissions to how you made cert etc
>
> https://stackoverflow.com/questions/27102176/curl-with-ssl-certificates-fails-error-58-unable-to-set-private-key-file

Thanks. I did follow this link. Unfortunately the Authex keys are loaded
onto the terminal and we need to use them, dont have luxury of converting
the format of them.

I did try changing the SSL_KEYTYPE to ENG curl_easy_setopt(curlHandle,
CURLOPT_SSLKEYTYPE, "ENG"); and have set the engines
if(curl_easy_setopt(curlHandle, CURLOPT_SSLENGINE, "engine_keyservice") !=
CURLE_OK)
{
 /* load the crypto engine */
 LOGF_TRACE("can't set crypto engine");
}
if(curl_easy_setopt(curlHandle, CURLOPT_SSLENGINE_DEFAULT, 1L) != CURLE_OK)
{
 /* set the crypto engine as default */
 /* only needed for the first time you load
a engine in a curl object... */
 LOGF_TRACE("can't set crypto engine as default");
}

Now, i am getting Curl Error Buffer: failed to load private key from crypto
engine

>
>
> On Thu, 20 Jun 2019 23:50:50 +0530
> Praveen Pvs via curl-users <curl-users_at_cool.haxx.se> wrote:
>
> > Hi All,
> >
> > Have been trying to debug this from yesterday, not able to figure it out.
> > Can someone help me here!
> > If i am not getting this to work, need to change my implementation from
> > Curl library usage to openssl calls.
> >
> > Appreciate your help and time
> >
> > Regards
> > Praveen
> >
> > On Thu, Jun 20, 2019 at 4:09 PM Praveen Pvs <meetpraveenpvs_at_gmail.com>
> > wrote:
> >
> > > Curl Error Buffer: unable to set private key file:
> > > '/mnt/flash/system/rkeys/usr1/key0.der' type DER
> > >
> > > Any reasons why setting the private key failing here!
> > >
> > > On Thu, Jun 20, 2019 at 10:08 AM Praveen Pvs <meetpraveenpvs_at_gmail.com
> >
> > > wrote:
> > >
> > >> Hi,
> > >>
> > >> I am experiencing error code 58 when i try to set the SSL certificate
> in
> > >> my code.
> > >>
> > >> Not sure if i am missing some options settings or problem with the SSL
> > >> certificate. Could you please let me know if i am doing something
> wrong?
> > >>
> > >> #define CA_CERT_FILE "ca-cert.pem" // Certification file
> > >>
> > >> #define SSL_OWN_CERT "/mnt/flash/system/rkeys/usr1/key0.crt"
> > >> #define SSL_OWN_KEY "/mnt/flash/system/rkeys/usr1/key0.der"
> > >>
> > >> std::string path;
> > >> path.assign("/mnt/flash/userdata/usr1/");
> > >> std::string certName;
> > >>
> > >> certName.assign(path.c_str());
> > >> certName.append(CA_CERT_FILE);
> > >>
> > >> curl_easy_setopt(curlHandle, CURLOPT_SSLCERTTYPE, "DER");
> > >> curl_easy_setopt(curlHandle, CURLOPT_SSLCERT, SSL_OWN_CERT);
> > >>
> > >> curl_easy_setopt(curlHandle, CURLOPT_SSLKEYTYPE, "DER");
> > >> curl_easy_setopt(curlHandle, CURLOPT_SSLKEY, SSL_OWN_KEY);
> > >>
> > >> curl_easy_setopt(curlHandle, CURLOPT_CAINFO,certName.c_str());
> > >> curl_easy_setopt(curlHandle, CURLOPT_CAPATH, path.c_str());
> > >>
> > >> When i do the Curl_easy_perform, its returning 58 error code. Have
> > >> attached sample certificate and keys file which i am using.
> > >>
> > >> Regards
> > >> Praveen
> > >>
> > >
>
> -----------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-06-20