<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SSL mit Curt]]></title><description><![CDATA[<p>Hi</p>
<p>Ich möchte eine SSL Verbindung auf <a href="http://swisscom-mobile.ch" rel="nofollow">swisscom-mobile.ch</a> herstellen und dort eine POST-Anfrage ausführen. Das Resultat möchte ich dann Ausgeben.<br />
Mein Problem ist nun, dass es irgendwie nicht wirklich funktioniert! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /><br />
Sobald die Anfrage gesendet wurde gibt mir CURL den Fehler zurück, dass es ein Problem mit dem lokalen SSL-Zertifikat hat! Kann mir jemand helfen, was ich ändern muss oder noch hinzufügen muss???</p>
<p>Hier mein Code:</p>
<pre><code class="language-cpp">const char *pEngine;

  const char *pCertFile = &quot;testcert.pem&quot;;
  const char *pCACertFile=&quot;cacert.pem&quot;;

  const char *pKeyName;
  const char *pKeyType;
const char *pPassphrase = NULL;

#if USE_ENGINE
  pKeyName  = &quot;rsa_test&quot;;
  pKeyType  = &quot;ENG&quot;;
  pEngine   = &quot;chil&quot;;            /* for nChiper HSM... */
#else
  pKeyName  = &quot;testkey.pem&quot;;
  pKeyType  = &quot;PEM&quot;;
  pEngine   = NULL;
#endif

   CURL *curl_post; 
   CURLcode res; 
   curl_slist *cookieptr; 
   CString cookieid; 
   CString buffer; 

   buffer=&quot;&quot;;
     curl_post = curl_easy_init(); 
     if(curl_post) { 
     curl_easy_setopt(curl_post, CURLOPT_URL, &quot;https://www.swisscom-mobile.ch/youth/youth_zone_home-de.aspx?login&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_USERAGENT, &quot;User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_POSTFIELDS, &quot;isiwebuserid=UID&amp;isiwebpasswd=PW&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_COOKIEFILE, &quot;&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_HEADER, 1); 
     curl_easy_setopt(curl_post, CURLOPT_WRITEFUNCTION, writer); 
     curl_easy_setopt(curl_post, CURLOPT_WRITEDATA, &amp;buffer); 

      if (pEngine)             /* use crypto engine */
      {
        if (curl_easy_setopt(curl_post, CURLOPT_SSLENGINE,pEngine) != CURLE_OK)
        {                     /* load the crypto engine */
          fprintf(stderr,&quot;can't set crypto engine\n&quot;);

        }
        if (curl_easy_setopt(curl_post, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK)
        { /* set the crypto engine as default */
          /* only needed for the first time you load
             a engine in a curl object... */
          fprintf(stderr,&quot;can't set crypto engine as default\n&quot;);

        }
      }
      /* cert is stored PEM coded in file... */
      /* since PEM is default, we needn't set it for PEM */
      curl_easy_setopt(curl_post,CURLOPT_SSLCERTTYPE,&quot;PEM&quot;);

      /* set the cert for client authentication */
      curl_easy_setopt(curl_post,CURLOPT_SSLCERT,pCertFile);

      /* sorry, for engine we must set the passphrase
         (if the key has one...) */
      if (pPassphrase)
        curl_easy_setopt(curl_post,CURLOPT_SSLKEYPASSWD,pPassphrase);

      /* if we use a key stored in a crypto engine,
         we must set the key type to &quot;ENG&quot; */
      curl_easy_setopt(curl_post,CURLOPT_SSLKEYTYPE,pKeyType);

      /* set the private key (file or ID in engine) */
      curl_easy_setopt(curl_post,CURLOPT_SSLKEY,pKeyName);

      /* set the file with the certs vaildating the server */
      curl_easy_setopt(curl_post,CURLOPT_CAINFO,pCACertFile);

      /* disconnect if we can't validate server's cert */
      curl_easy_setopt(curl_post,CURLOPT_SSL_VERIFYPEER,1);

        res = curl_easy_perform(curl_post); 

        if(res != CURLE_OK) { 
            curl_easy_cleanup(curl_post); 
			AfxMessageBox(curl_easy_strerror(res));

        }    

		AfxMessageBox(buffer);

        /* always cleanup */ 
        curl_easy_cleanup(curl_post); 
     }
</code></pre>
<p>Vielen Dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/159225/ssl-mit-curt</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 22:53:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159225.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Sep 2006 07:32:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SSL mit Curt on Wed, 13 Sep 2006 07:32:06 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Ich möchte eine SSL Verbindung auf <a href="http://swisscom-mobile.ch" rel="nofollow">swisscom-mobile.ch</a> herstellen und dort eine POST-Anfrage ausführen. Das Resultat möchte ich dann Ausgeben.<br />
Mein Problem ist nun, dass es irgendwie nicht wirklich funktioniert! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /><br />
Sobald die Anfrage gesendet wurde gibt mir CURL den Fehler zurück, dass es ein Problem mit dem lokalen SSL-Zertifikat hat! Kann mir jemand helfen, was ich ändern muss oder noch hinzufügen muss???</p>
<p>Hier mein Code:</p>
<pre><code class="language-cpp">const char *pEngine;

  const char *pCertFile = &quot;testcert.pem&quot;;
  const char *pCACertFile=&quot;cacert.pem&quot;;

  const char *pKeyName;
  const char *pKeyType;
const char *pPassphrase = NULL;

#if USE_ENGINE
  pKeyName  = &quot;rsa_test&quot;;
  pKeyType  = &quot;ENG&quot;;
  pEngine   = &quot;chil&quot;;            /* for nChiper HSM... */
#else
  pKeyName  = &quot;testkey.pem&quot;;
  pKeyType  = &quot;PEM&quot;;
  pEngine   = NULL;
#endif

   CURL *curl_post; 
   CURLcode res; 
   curl_slist *cookieptr; 
   CString cookieid; 
   CString buffer; 

   buffer=&quot;&quot;;
     curl_post = curl_easy_init(); 
     if(curl_post) { 
     curl_easy_setopt(curl_post, CURLOPT_URL, &quot;https://www.swisscom-mobile.ch/youth/youth_zone_home-de.aspx?login&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_USERAGENT, &quot;User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_POSTFIELDS, &quot;isiwebuserid=UID&amp;isiwebpasswd=PW&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_COOKIEFILE, &quot;&quot;); 
     curl_easy_setopt(curl_post, CURLOPT_HEADER, 1); 
     curl_easy_setopt(curl_post, CURLOPT_WRITEFUNCTION, writer); 
     curl_easy_setopt(curl_post, CURLOPT_WRITEDATA, &amp;buffer); 

      if (pEngine)             /* use crypto engine */
      {
        if (curl_easy_setopt(curl_post, CURLOPT_SSLENGINE,pEngine) != CURLE_OK)
        {                     /* load the crypto engine */
          fprintf(stderr,&quot;can't set crypto engine\n&quot;);

        }
        if (curl_easy_setopt(curl_post, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK)
        { /* set the crypto engine as default */
          /* only needed for the first time you load
             a engine in a curl object... */
          fprintf(stderr,&quot;can't set crypto engine as default\n&quot;);

        }
      }
      /* cert is stored PEM coded in file... */
      /* since PEM is default, we needn't set it for PEM */
      curl_easy_setopt(curl_post,CURLOPT_SSLCERTTYPE,&quot;PEM&quot;);

      /* set the cert for client authentication */
      curl_easy_setopt(curl_post,CURLOPT_SSLCERT,pCertFile);

      /* sorry, for engine we must set the passphrase
         (if the key has one...) */
      if (pPassphrase)
        curl_easy_setopt(curl_post,CURLOPT_SSLKEYPASSWD,pPassphrase);

      /* if we use a key stored in a crypto engine,
         we must set the key type to &quot;ENG&quot; */
      curl_easy_setopt(curl_post,CURLOPT_SSLKEYTYPE,pKeyType);

      /* set the private key (file or ID in engine) */
      curl_easy_setopt(curl_post,CURLOPT_SSLKEY,pKeyName);

      /* set the file with the certs vaildating the server */
      curl_easy_setopt(curl_post,CURLOPT_CAINFO,pCACertFile);

      /* disconnect if we can't validate server's cert */
      curl_easy_setopt(curl_post,CURLOPT_SSL_VERIFYPEER,1);

        res = curl_easy_perform(curl_post); 

        if(res != CURLE_OK) { 
            curl_easy_cleanup(curl_post); 
			AfxMessageBox(curl_easy_strerror(res));

        }    

		AfxMessageBox(buffer);

        /* always cleanup */ 
        curl_easy_cleanup(curl_post); 
     }
</code></pre>
<p>Vielen Dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1136364</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1136364</guid><dc:creator><![CDATA[addict]]></dc:creator><pubDate>Wed, 13 Sep 2006 07:32:06 GMT</pubDate></item></channel></rss>