一、curl常見schannel錯誤
- schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL<0x80090322>
該錯誤主要原因是服務端使用了SNI技術(就是在同一台服務器配置了多個安全證書),而xp不支持SNI,所以xp在訪問https接口時,如果服務器默認的第一個證書跟https請求證書不一致,就會導致證書驗證失敗。
- schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed). More detail may be available in the Windows System event log.
該錯誤主要原因是xp支持的ssl/tls算法較老,導致握手失敗。
二、解決方案
使用libcurl+openssl替代libcurl+winssl,具體參考使用curl,libcurl訪問Https 。