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

SSL client certificates #162

Closed
JohnSmall opened this issue Sep 11, 2012 · 9 comments
Closed

SSL client certificates #162

JohnSmall opened this issue Sep 11, 2012 · 9 comments

Comments

@JohnSmall
Copy link

The documentation on how to use HTTParty with SSL is completely absent.

Here's what I need to do;-
We have a server we can make rest requests to, the server requires client certificates. I'm just learning this, but it seems the client certs can come in many forms, with and without passwords and such like. I'm using Firefox on a Mac, and I can backup my cert to a pk12 file, with a password, or export to a pem file, without a password.

Reading the code in HTTParty it seems that if I take the pem file option then I need to supply a password, and there's no option for feeding in a PK12 file.

How do I get this stuff to work?

@claco
Copy link

claco commented Oct 6, 2013

@jnunemaker
Copy link
Owner

I honestly have no idea. We have several ssl options:

https://github.com/jnunemaker/httparty/blob/master/lib/httparty.rb#L39-L67
https://github.com/jnunemaker/httparty/blob/master/lib/httparty.rb#L304-L356

Let me know what you find out. Happy to pull documentation updates or code fixes with tests.

@kurenn
Copy link
Contributor

kurenn commented Sep 18, 2015

Hey @JohnSmall I think you can do it with

class Client
    include HTTParty

    debug_output $stdout
    pkcs12 File.read("certs/filename.p12"), "123456"
end

I have been working with SSL for a client and I had troubles setting this up, there is not to much documentation out there, it would be good to have some...what a about a wiki article?

@kurenn
Copy link
Contributor

kurenn commented Nov 17, 2015

I can add some documentation on how to achieve this...would be better to add a wiki article or on the main README?

@jnunemaker
Copy link
Owner

I would lean toward a docs/ folder with a markdown file. Then in the code or readme we can just link to that. Coolio?

@kurenn
Copy link
Contributor

kurenn commented Nov 18, 2015

Sure, I'll work on the PR later tonite!

@kurenn
Copy link
Contributor

kurenn commented Nov 21, 2015

You can find the doc at #449

@pimlottc-gov
Copy link

For posterity, the docs are at ../tree/master/docs#working-with-ssl

@jji-fieldwire
Copy link

jji-fieldwire commented Mar 24, 2021

are people storing their certs in their repos and the passwords in env vars? or is there a better way of doing it

nvm, seems the way to do it is have the cert in the repo, & the password passed in via ENV Var

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

No branches or pull requests

7 participants