Giter VIP home page Giter VIP logo

Comments (6)

chkr1011 avatar chkr1011 commented on May 18, 2024

Hi,
yes I know that global solution from regular .NET framework.
In general there is a dedicated object for Tls options for this in the MQTT client.
In my opinion there should be a new boolean value which allows ignoring self signed certificates. Something similar is already there for revoked certificates. Maybe this can be reused or already works for your case!?
Then the implementations should inspect the options and add a handler in the SslStream etc. so that there is no new factory required and the user can set it with a simple option.

What do you think about this solution?

Best regards
Christian

from mqttnet.

rydergillen-compacSort avatar rydergillen-compacSort commented on May 18, 2024

I don't think a simple Boolean property would be sufficient. There isn't a specific property on a Self-Signed cert identifying it as such. A Func<,,,> matching the signature of the delegate could be exposed as a property. This would allow the developer full control over what certificates to accept/reject.

I think something alone these lines would work for my specific use case. I guess what I was also trying to resolve is the need to always have a property for each setting that should be mapped back. At some point if the needed functionality deviates from the standard design the developer would be better off constructing the SSL stream externally.

The public MqttTcpChannel(Socket socket, SslStream sslStream) signature indicates this is possible, alas the SslStream property is always overwritten by an internal call during ConnectAsync(), making it unsuitable for Client communications.

from mqttnet.

chkr1011 avatar chkr1011 commented on May 18, 2024

I agree but the Func you mentioned must be sufficient for all frameworks. I saw that core has different properties than the classic .NET stuff. If you provide such a function the implementation must map this function to the used stream which might be not possible because UWP don't has this function. It only has several enum which are describing what certificate status can be ignored. So a Func will not make sense in my opinion. A boolean is easier for that. What do you think about this?

Best regards
Christian

from mqttnet.

chkr1011 avatar chkr1011 commented on May 18, 2024

Please have a look at the develop branch. I added several TLS options regarding certificate validation. Please let me know if this fits your needs.

from mqttnet.

rydergillen-compacSort avatar rydergillen-compacSort commented on May 18, 2024

Looks like it should work fine for my needs. I will take the updated package a run a few tests.

from mqttnet.

chkr1011 avatar chkr1011 commented on May 18, 2024

I also added a callback mechanism for dealing with complex certificate validations. It is described in the wiki. I will close this ticket. Please let me know it you need more features to deal with certificates.

Best regards
Christian

from mqttnet.

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.