Coder Social home page Coder Social logo

SSL certificate pinning about cpr HOT 3 OPEN

arekmula avatar arekmula commented on July 24, 2024
SSL certificate pinning

from cpr.

Comments (3)

COM8 avatar COM8 commented on July 24, 2024

@arekmula thanks for reporting!
You are right, there is no real support for it yet. But I will try to add support for it over the weekend if everything goes as planed.
The Interface would than look something like:

    /**
     * This callback function gets called by libcurl just before the initialization of an SSL connection
     * after having processed all other SSL related options to give a last chance to an application
     * to modify the behavior of the SSL initialization.
     *
     * If an error is returned from the callback no attempt to establish a connection is made
     * and the perform operation returns the callback's error code.
     * For no error return CURLE_OK from inside 'curl/curl.h'
     *
     * More/Source: https://curl.se/libcurl/c/CURLOPT_SSL_CTX_FUNCTION.html
     **/
    void SetSslCtxCallback(const SslCtxCallback& ssl_ctx);

Resulting in something like:

std::function<CURLcode(const std::shared_ptr<CurlHolder>& curl_holder, void* ssl_ctx, intptr_t userdata)>

for your custom callback.

from cpr.

arekmula avatar arekmula commented on July 24, 2024

I have it already implemented and tested on my side. I can raise the MR. I would only need to adapt the API slightly to your proposed one and cover it with tests.

from cpr.

arekmula avatar arekmula commented on July 24, 2024

Raised the WIP Pull request: #1020

I was not sure about passing the CurlHolder. There's no constructor of CurlHolder accepting CURL* which I could use inside of sslCtxUserFunction. We can pass CURL* or don't pass it at all.

Tests are missing but I will try to add them tomorrow or on monday.

from cpr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.