mosquitto-users team mailing list archive
-
mosquitto-users team
-
Mailing list archive
-
Message #00156
Re: mosquitto_pub with SSL: can I provide PEM pass phrase
Hi Sharon,
> I am trying to invoke mosquitto_pub with SSL. I provide all the necessary certificates and the call is successful.
> However, the program prompts me to get PEM pass phrase. I would like to provide that info in an argument or
> some other way that is not interactive.
It's not possible to do this with mosquitto_pub as it stands, but you
should be able to modify it to your needs quite easily. In the
mosquitto_tls_set() call you should provide a password callback
function:
* pw_callback - if keyfile is encrypted, set pw_callback to allow your client
* to pass the correct password for decryption. If set to NULL,
* the password must be entered on the command line.
* Your callback must write the password into "buf", which is
* "size" bytes long. The return value must be the length of the
* password. "userdata" will be set to the calling mosquitto
* instance.
How you get the password is then entirely up to you. I can take a look
at it in a few days if necessary.
Cheers,
Roger
References