{"action":"created","issue":{"url":"https://api.github.com/repos/keybase/go-crypto/issues/40","repository_url":"https://api.github.com/repos/keybase/go-crypto","labels_url":"https://api.github.com/repos/keybase/go-crypto/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/keybase/go-crypto/issues/40/comments","events_url":"https://api.github.com/repos/keybase/go-crypto/issues/40/events","html_url":"https://github.com/keybase/go-crypto/pull/40","id":194212712,"number":40,"title":"ECDH encryption/decryption support","user":{"login":"zapu","id":451974,"avatar_url":"https://avatars.githubusercontent.com/u/451974?v=3","gravatar_id":"","url":"https://api.github.com/users/zapu","html_url":"https://github.com/zapu","followers_url":"https://api.github.com/users/zapu/followers","following_url":"https://api.github.com/users/zapu/following{/other_user}","gists_url":"https://api.github.com/users/zapu/gists{/gist_id}","starred_url":"https://api.github.com/users/zapu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zapu/subscriptions","organizations_url":"https://api.github.com/users/zapu/orgs","repos_url":"https://api.github.com/users/zapu/repos","events_url":"https://api.github.com/users/zapu/events{/privacy}","received_events_url":"https://api.github.com/users/zapu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-08T00:14:34Z","updated_at":"2017-01-26T14:18:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/keybase/go-crypto/pulls/40","html_url":"https://github.com/keybase/go-crypto/pull/40","diff_url":"https://github.com/keybase/go-crypto/pull/40.diff","patch_url":"https://github.com/keybase/go-crypto/pull/40.patch"},"body":"This pull request introduces encryption and decryption using ECDH keys (no cv25519 yet though, read below). Most of new code is in `openpgp/packet/ecdh.go` and `openpgp/ecdh/ecdh.go`. Package `ecdh` got all the functions that were independent enough not to need to import anything from package `packet` (which would create circular dependency) - random scalars, KDF (but creating \"KDFparams\" buffer is in `packet`),  rfc3394 key wrapping, padding. \r\n\r\nEncryption is done mostly in `ecdh` package, but a lot of things have to be passed as arguments. Decryption is mostly in `packet` package (`ecdh.go` file). Let me know which is better - I'll either rewrite Decryption in similar fashion, or move encryption to the `packet` package.\r\n\r\nThere are new functions for reading MPI coords for ECDH in `openpgp/packet/packet.go`. `EncryptedKey` has new `ecdh_C []byte` field, because ECDH encryption serializes curve coordinates and AES-keywrapped buffer.\r\n\r\n`ecdh_test.go` now also tests encryption/decryption. The test that was already there was \"completed\" to decrypt message, and also there is a new test that does roundtrip encryption/decryption with test additional two keys with two different curves, created with gpg.\r\n\r\nCV25519 needs EdDSA support. There is some ground work being done, but it's very far from being able to actually sign anything. Also there is no ECDH key generation - I haven't gotten that far in understanding go-crypto yet.\r\n\r\nThe question is, where to go with this. I've found a fork [1] that also implements ECDH and has better go code that I was able to write. It also does some much needed cleanup in other places. I can try to bring that code in, instead. I wish I had found it sooner :wink: \r\n\r\n[1] https://github.com/benburkert/openpgp"},"comment":{"url":"https://api.github.com/repos/keybase/go-crypto/issues/comments/275398468","html_url":"https://github.com/keybase/go-crypto/pull/40#issuecomment-275398468","issue_url":"https://api.github.com/repos/keybase/go-crypto/issues/40","id":275398468,"user":{"login":"zapu","id":451974,"avatar_url":"https://avatars.githubusercontent.com/u/451974?v=3","gravatar_id":"","url":"https://api.github.com/users/zapu","html_url":"https://github.com/zapu","followers_url":"https://api.github.com/users/zapu/followers","following_url":"https://api.github.com/users/zapu/following{/other_user}","gists_url":"https://api.github.com/users/zapu/gists{/gist_id}","starred_url":"https://api.github.com/users/zapu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zapu/subscriptions","organizations_url":"https://api.github.com/users/zapu/orgs","repos_url":"https://api.github.com/users/zapu/repos","events_url":"https://api.github.com/users/zapu/events{/privacy}","received_events_url":"https://api.github.com/users/zapu/received_events","type":"User","site_admin":false},"created_at":"2017-01-26T14:18:08Z","updated_at":"2017-01-26T14:18:08Z","body":"Researched and added a test regarding the mpi length checking. GPG doesn't care and neither should we - different implementation may round the number of bits there or not, and both are fine. I created an encrypted message where the coordinates serialized are unnecessarily big, where the bit size is not even different by rounding margin, and they still work fine in GPG."}}
{"actor":{"display_login":"zapu"}}