-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Certificate based authentication for client #115
Comments
Hi, Loading is at the moment only described for the server at the Wiki (Server > Using a certificate). But the code is the same as for loading a client certificate (beside that the private key is not part of it). Best regards |
@chkr1011 Thank you for your reply. |
Please try it with the following code (for loading the cert).
Because this is a self signed certificate you probably have to add a certificate handler (described in the WIki) and ensure that it is accepted. If this also doesn't help please let me know. |
@chkr1011 Thank you for your reply, I already tried it, unfortunately it did not work. I have also tried to create a pfx file from .crt and .key still no luck.
|
@malichishti Please try again with nuget package 2.6.0-rc2. There are several hotfixes included for TLS communication. |
Version 2.6.0 is now released. If you problem still exists please let me know. |
I have the latest code as for 2017-12-18, and I am still running into this error with the **System.AggregateException: 'One or more errors occurred. (A call to SSPI failed, see inner exception.)' So, what I did is, per the notes here, I have created the pfx filke with the .pem.crt with the private.pem.key. I am wondering if the issue is more in the Cert that than the code. However, the error messages are not helping too much on narrowing this down. Suggestions on what I am doing wrong is appreciated. Below is my base code from the Program file (in Main). This is meant to be a client for testing end to end communication (eventually, I will be pairing this with another client to create a ping-pong test across MQTT)
Thanks Robert |
Hello all: and: |
var options = new MqttClientOptionsBuilder() |
@rwhertenstein2: I had the same problem. See code below:
|
Hi My pc must dialogue with Amazon AWS iot. I followed amazon wizard (node js) to create a connection and certificate for my pc. Pippo.cert.pem,Pippo.private.key,Pippo.public.key,Root-ca.crt If i use raspberry and a Python script, all works correctly . It connects, publish an so on… In the python script, i see that in the connections options, it uses and pass 3 certificate files.
OK it works I need to do the same thing on a windows pc using VB.net (but I have tried also in C++ and it is the same) This is my code ……
If i make my program run, it arrives at the connect line and it fails. It cannot connect to the AWS iot MQTT server (While python with the same certificate does) uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException: 'Exception connecting to the broker' if I change the connection instruction with a FALSE instead of a TRUE
I receive this error message.
Can you help me ?? Please help me. Thanks a lot |
I have tried everything..... |
I am following these comments to work out my own issues for my Xamarin app. I can't seem to export the certificate (the Export method hangs with no error message). I do get this warning:
has anyone encountered this, and is there a workaround? |
Hi.
You must install certificate MANUALLY on the computer store.
Use mmc snapin. Add Certificate, choose, Computer, the add you certificate.
After that the certificate will be usable and found.
This took me 1 month to discover . Nobody told me this.
HTH
Leonardo Butelli
IT Manager
Optoteam S.r.l.
Tel : +39 055 310186
Email : [email protected]<mailto:[email protected]>
[cid:[email protected]]
P Non stampare questo messaggio se non veramente indispensabile
Il contenuto di questo messaggio, e ogni eventuale documento a quest'ultimo allegato, e' rivolto unicamente alle persone cui e' indirizzato e può contenere informazioni di natura riservata, soggette alla normativa in materia di segreto aziendale nonchè in materia di protezione dei dati personali (Decreto Legislativo 30 Giugno 2003, n.196 - Codice in materia di protezione dei dati personali). Sono severamente vietati, l'uso, la divulgazione, la riproduzione e la diffusione di questo messaggio in mancanza di preventiva autorizzazione del destinatario. Se avete ricevuto questo messaggio per errore, vogliate cortesemente avvisare immediatamente il mittente per telefono, fax o e-mail e distruggere le informazioni erroneamente ricevute. Il mittente non rilascia alcuna garanzia e declina qualsivoglia responsabilità relative al contenuto, all'esattezza e alla completezza del messaggio ovvero inerenti cambiamenti intervenuti dopo l'invio o altri rischi conseguenti dalla trasmissione elettronica, da virus, etc.
From: Zach Cleghern <[email protected]>
Sent: sabato 18 agosto 2018 00:09
To: chkr1011/MQTTnet <[email protected]>
Cc: Leonardo Butelli - Optoteam S.r.l. <[email protected]>; Comment <[email protected]>
Subject: Re: [chkr1011/MQTTnet] Certificate based authentication for client (#115)
I am following these comments to work out my own issues for my Xamarin app. I can't seem to export the certificate (the Export method hangs with no error message). I do get this warning:
Mono TODO: X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported
has anyone encountered this, and is there a workaround?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#115 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AjTlPenXP_HCrZY5Ux-bmsTtVtSjoJtIks5uRz8MgaJpZM4QlQU7>.
…________________________________
Optoteam Srl This email was scanned by Bitdefender
________________________________
Optoteam Srl This email was scanned by Bitdefender
|
I am using Xamarin and thus my project is on mobile, but thanks! |
None of these helped, having same issues. There is no real help from the error message in the library. |
Perhaps this may help. I have two examples, one connecting to an Azure IoT Hub and the other to AWS IoT service. Both use certificates to connect. Azure IoT. It is important to read this https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started and this https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md first to correctly configure CA certificates for the IoT hub. Note: the TestDevice02.pfx below is the certificate that was created from "Step 4 - Create a new device" here https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md
` AWS IoT. I am less familiar with the setup on AWS, however the important point that got it working was the "Converting device certificate from .pem to .pfx" section from https://github.com/aws-samples/iot-dotnet-publisher-consumer. For convivence here it is: In order to establish an MQTT connection with the AWS IoT platform, the root CA certificate, the private key of the thing, and the certificate of the thing/device are needed. The .NET cryptographic APIs can understand root CA (.crt), device private key (.key) out-of-the-box. It expects the device certificate to be in the .pfx format, not the .pem format. Hence we need to convert the device certificate from .pem to .pfx.We'll leverage the openssl for converting .pem to .pfx. Navigate to the folder where all the security artifacts are present and launch bash for Windows 10. The syntax for converting .pem to .pfx is below: openssl pkcs12 -export -in iotdevicecertificateinpemformat -inkey iotdevivceprivatekey -out devicecertificateinpfxformat -certfile rootcertificatefile If you replace with actual file names the syntax will look like below openssl pkcs12 -export -in certificates\certificate.cert.pem -inkey certificates\certificate.private.key -out certificates\certificate.cert.pfx -certfile certificates\AmazonRootCA1.crt `
` |
Hi,
I'm trying to use MQTTnet as a client to my broker which requires client certificate to authenticate it. How can i achieve this?
Do you support client authentication based on certificates? Each client will have its own certificate.
Regards,
Ali
The text was updated successfully, but these errors were encountered: