1. 程式人生 > >linux下的openssl配置及糾錯

linux下的openssl配置及糾錯

因工程中需要用到https伺服器證書來進行驗證。需要用到openssl三方庫來進行解析。

(1)首先下載openssl,地址是https://www.openssl.org/source/;然後解壓後進入openssl-1.1.0e該目錄下,進行編譯./config,然後make,這樣生成了兩個libcrypto.a和libssl.a靜態庫以及.so的動態庫,工程裡使用的是靜態庫。

(2)將靜態庫路徑以及openssl-1.1.0e下的include標頭檔案包到工程目錄下。

(3)相應的qt IDE需要新增 LIBS += libcrypto.a libssl.a (編譯後可能會找不到undefined reference to `dlerror'

或者undefined reference to `pthread_setspecific'解決辦法是需要新增 -lpthread -ldl連結)

這樣可以使用openssl庫進行程式設計了。可以進行證書解析,演算法等等操作。