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 documentation for how to build a keystore that can be used for client certs and peer verification #138

Open
Fitzsimmons opened this issue Feb 14, 2019 · 1 comment

Comments

@Fitzsimmons
Copy link

After some trial and error, I've finally figured out how to build a keystore file that march hare can use for supplying client certs and for verifying the validity of the server's cert (i.e. peer verification, as introduced in 3.1.0). It would be great to add some official documentation of this somewhere, but I'm not sure where to do that, so this is an issue instead of a pull request.

Anyway, first off, to make a keystore that java can read for client certificates, you have to use openssl, since java's keytool does not provide a way of importing private keys. 😕

openssl pkcs12 -export -out keystore.p12 -in example.crt -inkey example.key -passout pass:abcd1234

If you use this p12 file with march hare, the new peer verification functionality will cause the connection to fail since the server's certificate is probably not the same one as your client certificate. So we need to add in a certificate to the p12 that will successfully validate the server's certificate. Specifically which CA certificate you need is going to depend a lot on your implementation, but the important part is knowing how to add it to the file. We have to use java's keytool to alter the pkcs12 file that was generated by openssl, since any additional certs added by openssl will not be recognized by java.

keytool -importcert -trustcacerts -noprompt -keystore keystore.p12 -storepass abcd1234 -file ca.crt

At this point you should be able to provide keystore.p12 to march hare and have it successfully perform the dual function of providing a client certificate and verifying the server certificate.

@Fitzsimmons Fitzsimmons changed the title Add documentation for how to build a keystore that can be used for client certs and key verification Add documentation for how to build a keystore that can be used for client certs and peer verification Feb 14, 2019
@michaelklishin
Copy link
Member

Is this meant to be a PR?

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

No branches or pull requests

2 participants