psk tls python

Asked by adamant

hey guys.
I'm a greenhand of mosquitto ,my question is how to use the psk file to communicate between the client and the broker
the broker configuration is as follows:
listener 8883
psk_file /etc/mosquitto/pskfile
psk_hint hint
tls_version tlsv1

pskfile:
greenhand:123890

now I don't know how to use the python client of mosquitto to connect to the broker and I find an API (member function of class mosquitto) like :
tls_set(self, ca_certs, certfile=None, keyfile=None, cert_reqs=2, tls_version=3, ciphers=None)(mosquitto)
should I use this and how to fill the parameter.what is necessary?
thank you so much

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Roger Light
Solved:
Last query:
Last reply:
Revision history for this message
Best Roger Light (roger.light) said :
#1

Unfortunately you can't use TLS-PSK with mosquitto.py (you should move
to using the Paho Python client instead btw) because Python doesn't
support TLS-PSK: http://bugs.python.org/issue19084

On Thu, Apr 10, 2014 at 10:16 AM, adamant
<email address hidden> wrote:
> New question #246799 on mosquitto:
> https://answers.launchpad.net/mosquitto/+question/246799
>
> hey guys.
> I'm a greenhand of mosquitto ,my question is how to use the psk file to communicate between the client and the broker
> the broker configuration is as follows:
> listener 8883
> psk_file /etc/mosquitto/pskfile
> psk_hint hint
> tls_version tlsv1
>
> pskfile:
> greenhand:123890
>
> now I don't know how to use the python client of mosquitto to connect to the broker and I find an API (member function of class mosquitto) like :
> tls_set(self, ca_certs, certfile=None, keyfile=None, cert_reqs=2, tls_version=3, ciphers=None)(mosquitto)
> should I use this and how to fill the parameter.what is necessary?
> thank you so much
>
> --
> You received this question notification because you are a member of
> Mosquitto PPA, which is an answer contact for mosquitto.

Revision history for this message
adamant (c-yongye) said :
#2

thank you for your help .that's right .I use the c API to do this now

Revision history for this message
adamant (c-yongye) said :
#3

Thanks Roger Light, that solved my question.