{"action":"created","issue":{"url":"https://api.github.com/repos/libtom/libtomcrypt/issues/227","repository_url":"https://api.github.com/repos/libtom/libtomcrypt","labels_url":"https://api.github.com/repos/libtom/libtomcrypt/issues/227/labels{/name}","comments_url":"https://api.github.com/repos/libtom/libtomcrypt/issues/227/comments","events_url":"https://api.github.com/repos/libtom/libtomcrypt/issues/227/events","html_url":"https://github.com/libtom/libtomcrypt/pull/227","id":235358871,"number":227,"title":"DH add dh_make_key_ex & co.","user":{"login":"karel-m","id":1918753,"avatar_url":"https://avatars1.githubusercontent.com/u/1918753?v=3","gravatar_id":"","url":"https://api.github.com/users/karel-m","html_url":"https://github.com/karel-m","followers_url":"https://api.github.com/users/karel-m/followers","following_url":"https://api.github.com/users/karel-m/following{/other_user}","gists_url":"https://api.github.com/users/karel-m/gists{/gist_id}","starred_url":"https://api.github.com/users/karel-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karel-m/subscriptions","organizations_url":"https://api.github.com/users/karel-m/orgs","repos_url":"https://api.github.com/users/karel-m/repos","events_url":"https://api.github.com/users/karel-m/events{/privacy}","received_events_url":"https://api.github.com/users/karel-m/received_events","type":"User","site_admin":false},"labels":[{"id":621636778,"url":"https://api.github.com/repos/libtom/libtomcrypt/labels/enhancement","name":"enhancement","color":"c2e0c6","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/libtom/libtomcrypt/milestones/1","html_url":"https://github.com/libtom/libtomcrypt/milestone/1","labels_url":"https://api.github.com/repos/libtom/libtomcrypt/milestones/1/labels","id":370469,"number":1,"title":"v1.18.0","description":"","creator":{"login":"sjaeckel","id":294374,"avatar_url":"https://avatars1.githubusercontent.com/u/294374?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaeckel","html_url":"https://github.com/sjaeckel","followers_url":"https://api.github.com/users/sjaeckel/followers","following_url":"https://api.github.com/users/sjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/sjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaeckel/subscriptions","organizations_url":"https://api.github.com/users/sjaeckel/orgs","repos_url":"https://api.github.com/users/sjaeckel/repos","events_url":"https://api.github.com/users/sjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/sjaeckel/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":110,"state":"open","created_at":"2013-07-04T11:54:15Z","updated_at":"2017-06-14T07:38:07Z","due_on":"2017-07-20T07:00:00Z","closed_at":null},"comments":8,"created_at":"2017-06-12T20:41:03Z","updated_at":"2017-06-16T15:03:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libtom/libtomcrypt/pulls/227","html_url":"https://github.com/libtom/libtomcrypt/pull/227","diff_url":"https://github.com/libtom/libtomcrypt/pull/227.diff","patch_url":"https://github.com/libtom/libtomcrypt/pull/227.patch"},"body":"The idea of `dh_make_key_ex` (which allows using custom DH group params) was suggested and implemented by @lkinley as a contribution to my libtomcrypt perl bindings.\r\n\r\nIt is simply about adding:\r\n```C\r\nint dh_make_key_ex(prng_state *prng, int wprng, char *prime_hex, char *base_hex, dh_key *key)\r\n```\r\n\r\nUnfortunately the implementation turned into a bunch of troubles&workarounds like changes to dh_key structure changes (incompatible) to import/export format etc.\r\n\r\nSome questions:\r\n* How far can we go in breaking DH API? (currently only in develop for some time, not released yet)\r\n* Is the format used for DH key export/import intended to compatible with some specification? (this PR changed it in an incompatible way)\r\n"},"comment":{"url":"https://api.github.com/repos/libtom/libtomcrypt/issues/comments/309050464","html_url":"https://github.com/libtom/libtomcrypt/pull/227#issuecomment-309050464","issue_url":"https://api.github.com/repos/libtom/libtomcrypt/issues/227","id":309050464,"user":{"login":"sjaeckel","id":294374,"avatar_url":"https://avatars1.githubusercontent.com/u/294374?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaeckel","html_url":"https://github.com/sjaeckel","followers_url":"https://api.github.com/users/sjaeckel/followers","following_url":"https://api.github.com/users/sjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/sjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaeckel/subscriptions","organizations_url":"https://api.github.com/users/sjaeckel/orgs","repos_url":"https://api.github.com/users/sjaeckel/repos","events_url":"https://api.github.com/users/sjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/sjaeckel/received_events","type":"User","site_admin":false},"created_at":"2017-06-16T15:03:39Z","updated_at":"2017-06-16T15:03:39Z","body":"> > expecting an ASN.1 sequence as created by openssl dhparams as input to dh_make_key_ex(). Then we could also use the same as parameter to dh_import_raw()\r\n> \r\n> This one was easy, see `dh_make_key_dhparam`.\r\n\r\nTrue, feel free to squash the fixups together and force-push :-D\r\n\r\n> > exporting the public key as SubjectPublicKeyInfo\r\n> \r\n> According to https://tools.ietf.org/html/rfc3279#section-2.3.3 we need `q` (factor of `p-1`) which we do not have and I do not know about a way how to get it (and unfortunately it is mandatory). FYI `q` is not even a part of dhparam generated by openssl. Which means that we are not able to follow rfc3279 when exporting public DH keys. Having non-standard SubjectPublicKeyInfo-based format is basically the same as having completely proprietary format.\r\n\r\nIIUC it boils down to using the DSA key-generation where we get `q`...\r\nI came to the conclusion when I saw that `openssl dhparam` offers an option `-dsaparam` which simply converts the DSA key and suddenly the DH key has 3 `INTEGER`s...\r\n\r\n> > what's dh_{de,en}crypt_key() again for? \r\n> \r\n> Well, I agree that these are a bit unusual but we have something similar in `ecc_*` so why not to have them here.\r\n\r\nIt's the same with `ecc_verify_hash()` where we have now a `ecc_verify_hash_raw()` because the old version was way too special...\r\nI don't think `dh_{de,en}crypt_key()` are useful and therefor I'd say we remove them if @lkinley doesn't need them.\r\n \r\n> > how about limiting DH for now to its basic functionality?\r\n> \r\n> I am not using DH that much myself; however for my perl bindings I need nearly all of the functions I have implemented, including `dh_make_key_ex`, `dh_export_raw`, `dh_import_raw`, `dh_check_pubkey`. I can imagine that we \"replace\" `dh_import_raw` with something like `dh_import_radix` (like already existing `rsa_import_radix` + `dsa_import_radix`), but I basically need them. @lkinley is the user (and contributor) of perl module Crypt::PK::DH so he can perhaps say a bit more about his use case(s).\r\n\r\nI couldn't find a reference to e.g. `dh_check_pubkey()` but I also didn't search very hard... \r\n`dh_make_key_ex()` seems to be only required because the MODP groups aren't in ltc yet... yeah sure you could also pass the two strings as parameters in your `generate_key` function but _please correct me if I'm wrong_ I doubt there's any software that originally exports its groups as hex-string...\r\n`{ex,im}port_raw()` are perfectly fine.\r\n\r\n@lkinley can you please say which API's you really need?\r\n"}}
{"actor":{"display_login":"sjaeckel"}}