Skip to content
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

Add optional passphrase to TLS parameters, to allow for passphrase protected PEM files #137

Closed
wants to merge 1 commit into from

Conversation

tobyjaffey
Copy link

No description provided.

@mcollina
Copy link
Member

@adamvr How about moving to an option-object for this?
Example:

mqtt.createSecureServer({
  key: fs.readFileSync(keyPath),
  cert: fs.readFileSync(certPath),
  passphrase: passphrase
}, function() { .... });

We will have to support the previous syntax too, as I don't want to bump the minor version for this issue.

@tobyjaffey
Copy link
Author

@adamvr @mcollina Long term, an option-object would be better, but, I guess it will break the API.
My change adds an optional parameter on the end, so should have no effect on existing code.

@mcollina
Copy link
Member

I'm thinking about supporting the current API and the new one.
It is possible using this technique:

function createSecureServer(key, cert, callback) {
  var opts;

  if (typeof key === 'object') {
     opts = key;
     callback = cert;
  } else {
     opts = {
       key: fs.readFileSync(key),
       cert: fs.readFileSync(cert)
     }
  }

  //  continue as usual
}

Can you implement this and add one test for it?

Many thanks!

@adamvr
Copy link
Member

adamvr commented Oct 20, 2013

👍 for an options object, so we can add more options later. I think the secureserver API wasn't very well thought out.

@mcollina
Copy link
Member

@tobyjaffey would you like to updated this and refactor for supporting both the old and new API?

@tobyjaffey
Copy link
Author

Sorry @mcollina, I'm not likely to get round to it for a while (until a customer shouts for it). Feel free to take over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants