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 dhparam generation to the cert generation script. #44

Open
lgarron opened this issue May 21, 2015 · 9 comments
Open

Add dhparam generation to the cert generation script. #44

lgarron opened this issue May 21, 2015 · 9 comments
Assignees

Comments

@lgarron
Copy link
Collaborator

lgarron commented May 21, 2015

April, would you mind adding this?

@april
Copy link
Collaborator

april commented May 21, 2015

Aye aye cap'n!

@april
Copy link
Collaborator

april commented May 29, 2015

@hotaru2k3 -- can you give me the steps that you used to generate dh-composite.pem and dh-small-subgroup.pem, so I can add them to the certificate and key generation script?

Thanks!

@lilyanatia
Copy link
Contributor

for dh-small-subgroup, i used a perl script (https://gist.github.com/hotaru2k3/5f01f5b987a718d45bb1; note that this is a horrible way to generate "real" parameters, but it's really fast if you don't need parameters that are actually secure), like so:
perl gendh.pl 2048 31

for dh-composite, i intended to just use 7^729 with 5 as the generator (#40), but apparently i accidentally replaced the file with dh-small-subgroup.pem... that should probably be fixed.
if you want to be really clever, openssl dhparam -check sometimes thinks this is a prime:

-----BEGIN DH PARAMETERS-----
MIGrAoGlIEshInKAeSezV2ca791LS3oPEnSWJc1xtUnWuLmJXpf8+frcrybGGNqD
yex/azkCBmG6Qi5sggrBTTuDKdbHHRahlTr9YKCqTGMBn5wpwI0FsMT80EH+vqpb
DoR15ulsxJR4726a6He0076BB708ZLNevH8r1xnGQXIHquwhUYEnGbW1uuZFYrzS
7UQXeirDFKRPNE30oS4NT7j/mcQJm/x3kksrAgEF
-----END DH PARAMETERS-----

i've been thinking about trying to generate a 2048-bit composite that fools openssl's prime check even more often, but the process looks really tedious.

@april
Copy link
Collaborator

april commented Jun 5, 2015

FYI, the "normal" dhparam ones are all in my push request. :)

@lgarron
Copy link
Collaborator Author

lgarron commented Jul 7, 2016

dh-composite.pem and dh-small-subgroup.pem are now reused unconditionally every time you generate cert stuff: https://github.com/google/badssl.com/tree/master/certs/src/dhparam

It would be nice to be able to regenerate these using e.g. @hotaru2k3's script.
(If this is slow, we can do what we currently do with dh2048.pem and place it in the certs/sets/test/pregen folder to avoid regenerating it, by default.

@april
Copy link
Collaborator

april commented Jul 7, 2016

I might be okay with having static DH files. They can take a long time to generate, especially on VMs.

@lgarron
Copy link
Collaborator Author

lgarron commented Jul 7, 2016

They can take a long time to generate, especially on VMs.

Yeah, that part is solved by the pregen folder. But I'd still like a way to force regenerating them from scratch.

@april
Copy link
Collaborator

april commented Jul 7, 2016

I believe the old certificate generator used to have that, must have been something that got excluded on the way in.

Can probably just have a make dhparams-regen that deletes the files that are currently in the pregen folder, and then creates them back in there by scratch. If you set the proper .gitignore on that folder, git should ignore any changes to those files.

@lgarron
Copy link
Collaborator Author

lgarron commented Jul 7, 2016

Can probably just have a make dhparams-regen that deletes the files that are currently in the pregen folder, and then creates them back in there by scratch. If you set the proper .gitignore on that folder, git should ignore any changes to those files.

I don't think we should ever delete anything from the pregen folders, but we can certainly add instructions for doing so.

If you're talking about adding all 6 current dhparams into certs/sets/test/pregen, that sounds fine by me. But note that cert generation actually happens outside the VM now, so that should only save a few seconds for each new/cleaned repo.

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

3 participants