Repository navigation
browser: support client certificate - #1859
Conversation
|
It seems that Chrome reads from cert_request_info->client_certs instead of letting user choose a custom file? |
yup that is the default behaviour where a user selects from the dialog populated with certificates from the system store, but i am trying to address 1 & 2 here . So if a user doesnt provide local client certificate , will fallback to the default behaviour (which havnt handled yet, because of unimplemented table dialog view). |
|
We can choose the first matched certificate as default behavior, so users don't have to do anything to get client certificate support for free. For further support when a certificate is requested we can probably emit a new event with available certificates and a callback to pass the selected one, this can be done in another PR. |
9e2a7cc to
f60c5cf
Compare
|
If local certificate path is not provided, will default to first certificate from the cert store currently. Depends on electron-archive/brightray#115 |
|
@zcbenz for default auto-selection , user needs to provide a certificate filter . Currently i am thinking of following chrome's web preference filter pattern . Thoughts ? /cc @kjlaw89 @thojansen |
|
That looks good to me, definitely simple enough. |
|
👍 looks good. ISSUER.CN would be the most important value for us |
There was a problem hiding this comment.
Should check for the case when certificate is empty.
There was a problem hiding this comment.
should it be checked ? if the certificate is empty the auth will abort.
There was a problem hiding this comment.
Calling ContinueWithCertificate with nullptr will finally reach here:
https://code.google.com/p/chromium/codesearch#chromium/src/net/url_request/url_request_job.cc&sq=package:chromium&type=cs&l=226
The code you were referencing checks for handle not cert.
We can provide an API to make it possible to choose which certificate to use in JavaScript, so developers can either filter out the one they want, or show the available certificates in GUI to let final users decide. app.setClientCertificateSelector (webContents, sslCertRequestInfo, callback) ->
callback(sslCertRequestInfo.certificates[0]);(It can be implemented in another PR.) |
f60c5cf to
52b2c0d
Compare
|
👍 |
browser: support client certificate
|
Hey @deepak1556, now that this was released I was able to give it a shot today. It definitely works selecting the first certificate from the store, but I was unable to get the command line switch to work how I would expect. Here's the code I was using: I did verify that the path to the certificate is correct. The p12 actually contains a password, which I'm guessing this method doesn't support, but I did do a .pem that does not have a password and I know works but still did not have any luck. Am I missing something? |
|
@kjlaw89 yup this method currently supports only PEM encoded data, but your code does seem fine. Just tested on OSX, havnt tested on windows though. It would be nice if you could open an issue on the repo to track it. Btw how are you generating the pem file ? |
|
@deepak1556 Okay, I opened up an issue for it. I'm not sure exactly what program we're using to generate the PEM files, but there's a pretty common Windows one. We normally create .p12 for our clients, which they just then install in the system certificate store and those work on all browsers. The .pem files are generated using the same method. Is there anything specific about the certificate that you want me to check or verify? |
|
@kjlaw89 i was testing with https://github.com/thojansen/client-certificates/blob/master/ssl/setup.sh , except was importing .pem from .p12 using openssl after the last step (which is plain text with both Certificate and private key). Just to be sure is you PEM file encrypted ? |
|
@deepak1556 I believe the process we use does the exact same thing, just behind the scenes. I don't think the PEM file is encrypted, but I'd have to check to be certain. I do know that the PEM file I was using does not require a password, unlike the .p12 that I was using. The PEM also contains both the certificate and private key I believe. |
|
Hey @deepak1556, have you had any luck fixing this? I'm starting full swing into my development now, so it'd be cool if this was resolved. I you need me to I can provide you a certificate that we generate with a limited access to our server so you can test with what we have. Thanks again for your work on this! Don't forget to claim the bounty when it's all done! |
|
@kjlaw89 didn't try since wasn't sure of what was missing in the certificate generation. Yeah it would be great if you could provide the certificate or the process of generation. |
Fixes #1221