cURL / Mailing Lists / curl-library / Single Mail

curl-library

EXTRACT PUBLIC KEY FROM X509 SERVER CERTIFICATE

From: TB Singh <tb.singh_at_indiatimes.com>
Date: Sun, 21 Oct 2012 15:05:04 +0530 (IST)

I am using libcurl 7.21.4 in Mac OS-X Mountain Lion using XCode. The program is a C code downloaded from the URL http://curl.haxx.se/libcurl/c/certinfo.html.
When I build this program, it builds successfully. At runtime, it gives an error:

certinfo(1892,0x7fff7261c960) malloc: *** error for object 0x100131138: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

Specifically, the problem is faced when the execution reaches the line

res = curl_easy_perform(curl);

The following is the stdout I get on the screen:

* About to connect() to www.networking4all.com port 443 (#0)
* Trying 213.249.64.245... * connected
* Connected to www.networking4all.com (213.249.64.245) port 443 (#0)
* SSL connection using DHE-RSA-AES256-SHA
* --- Certificate chain
* 0 Subject: 1.3.6.1.4.1.311.60.2.1.3=NL; businessCategory=Private Organization; serialNumber=20099481 0000; C=NL; ST=Drenthe; L=Emmen; O=Networking4all B.V.; OU=Terms of use at www.verisign.com/rpa (c)05; CN=www.networking4all.com
* Issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)06; CN=VeriSign Class 3 Extended Validation SSL SGC CA
* Version: 3 (0x2)
* Serial Number:
* Signature Algorithm: sha1WithRSAEncryption
* Start date: 2011-09-27 00:00:00 GMT
* Expire date: 2013-11-25 23:59:59 GMT
* Public Key Algorithm: rsaEncryption
* RSA Public Key (4096 bits)
* rsa(n): eb:
com_module(1892,0x7fff7261c960) malloc: *** error for object 0x100131138: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

I am specifically interested in extracting the RSA Public Key from the certificate so that I can carryout some encryption using openssl lib.

Any help in overcoming the problem and achieving the goal is welcome.
Thanks!

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-21