{"action":"created","comment":{"url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/comments/230984849","pull_request_review_id":171847161,"id":230984849,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDk4NDg0OQ==","diff_hunk":"@@ -415,3 +429,17 @@ processCertificateRequest ctx p = processServerHelloDone ctx p\n processServerHelloDone :: Context -> Handshake -> IO (RecvState m)\n processServerHelloDone _ ServerHelloDone = return RecvStateDone\n processServerHelloDone _ p = unexpected (show p) (Just \"server hello data\")\n+\n+requiredCertKeyUsage :: Cipher -> Maybe ExtKeyUsageFlag\n+requiredCertKeyUsage cipher =\n+    case cipherKeyExchange cipher of\n+        CipherKeyExchange_RSA         -> Just KeyUsage_keyEncipherment\n+        CipherKeyExchange_DH_Anon     -> Nothing\n+        CipherKeyExchange_DHE_RSA     -> Just KeyUsage_digitalSignature\n+        CipherKeyExchange_ECDHE_RSA   -> Just KeyUsage_digitalSignature\n+        CipherKeyExchange_DHE_DSS     -> Just KeyUsage_digitalSignature\n+        CipherKeyExchange_DH_DSS      -> Just KeyUsage_keyAgreement\n+        CipherKeyExchange_DH_RSA      -> Just KeyUsage_keyAgreement\n+        CipherKeyExchange_ECDH_ECDSA  -> Just KeyUsage_keyAgreement\n+        CipherKeyExchange_ECDH_RSA    -> Just KeyUsage_keyAgreement\n+        CipherKeyExchange_ECDHE_ECDSA -> Just KeyUsage_digitalSignature","path":"core/Network/TLS/Handshake/Client.hs","position":54,"original_position":54,"commit_id":"aeb89a83e9f4bd2b363a68f4411ac3a954c87ccf","original_commit_id":"aeb89a83e9f4bd2b363a68f4411ac3a954c87ccf","user":{"login":"vdukhovni","id":1107986,"node_id":"MDQ6VXNlcjExMDc5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/1107986?v=4","gravatar_id":"","url":"https://api.github.com/users/vdukhovni","html_url":"https://github.com/vdukhovni","followers_url":"https://api.github.com/users/vdukhovni/followers","following_url":"https://api.github.com/users/vdukhovni/following{/other_user}","gists_url":"https://api.github.com/users/vdukhovni/gists{/gist_id}","starred_url":"https://api.github.com/users/vdukhovni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdukhovni/subscriptions","organizations_url":"https://api.github.com/users/vdukhovni/orgs","repos_url":"https://api.github.com/users/vdukhovni/repos","events_url":"https://api.github.com/users/vdukhovni/events{/privacy}","received_events_url":"https://api.github.com/users/vdukhovni/received_events","type":"User","site_admin":false},"body":"I should further note that with the only mention of `keyUsage` enforcement in TLS RFCs being in TLS 1.3 (RFC8446, appendix E.8) it is rather ironic that we're enforcing the constraint based on the selected cipher, since in TLS 1.3 the ciphers don't actually select the key exchange method, that's based on the signature algorithms extension and certificate type. So the check is entirely ineffective with TLS 1.3!\r\n\r\nSo perhaps this PR not only causes some interoperability issues, but also fails to achieve the goals it set out to meet. :-(","created_at":"2018-11-06T02:43:23Z","updated_at":"2018-11-06T02:46:54Z","html_url":"https://github.com/vincenthz/hs-tls/pull/274#discussion_r230984849","pull_request_url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/comments/230984849"},"html":{"href":"https://github.com/vincenthz/hs-tls/pull/274#discussion_r230984849"},"pull_request":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274"}}},"pull_request":{"url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274","id":180703396,"node_id":"MDExOlB1bGxSZXF1ZXN0MTgwNzAzMzk2","html_url":"https://github.com/vincenthz/hs-tls/pull/274","diff_url":"https://github.com/vincenthz/hs-tls/pull/274.diff","patch_url":"https://github.com/vincenthz/hs-tls/pull/274.patch","issue_url":"https://api.github.com/repos/vincenthz/hs-tls/issues/274","number":274,"state":"closed","locked":false,"title":"Verify certificate key usage","user":{"login":"ocheron","id":2415051,"node_id":"MDQ6VXNlcjI0MTUwNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2415051?v=4","gravatar_id":"","url":"https://api.github.com/users/ocheron","html_url":"https://github.com/ocheron","followers_url":"https://api.github.com/users/ocheron/followers","following_url":"https://api.github.com/users/ocheron/following{/other_user}","gists_url":"https://api.github.com/users/ocheron/gists{/gist_id}","starred_url":"https://api.github.com/users/ocheron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocheron/subscriptions","organizations_url":"https://api.github.com/users/ocheron/orgs","repos_url":"https://api.github.com/users/ocheron/repos","events_url":"https://api.github.com/users/ocheron/events{/privacy}","received_events_url":"https://api.github.com/users/ocheron/received_events","type":"User","site_admin":false},"body":"This is to address one issue reported in #155:\r\n```\r\n FAIL certificate has invalid key usage for HTTPS connection [reject bad-key-usage.badtls.io:11005]\r\n      output: 200 OK\r\n```\r\n","created_at":"2018-04-10T19:25:08Z","updated_at":"2018-11-06T02:46:54Z","closed_at":"2018-05-07T08:58:44Z","merged_at":"2018-05-07T08:58:44Z","merge_commit_sha":"c1a1d5375e5705b6e8a2944460f20de135a49200","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274/commits","review_comments_url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274/comments","review_comment_url":"https://api.github.com/repos/vincenthz/hs-tls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vincenthz/hs-tls/issues/274/comments","statuses_url":"https://api.github.com/repos/vincenthz/hs-tls/statuses/aeb89a83e9f4bd2b363a68f4411ac3a954c87ccf","head":{"label":"ocheron:key-usage","ref":"key-usage","sha":"aeb89a83e9f4bd2b363a68f4411ac3a954c87ccf","user":{"login":"ocheron","id":2415051,"node_id":"MDQ6VXNlcjI0MTUwNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2415051?v=4","gravatar_id":"","url":"https://api.github.com/users/ocheron","html_url":"https://github.com/ocheron","followers_url":"https://api.github.com/users/ocheron/followers","following_url":"https://api.github.com/users/ocheron/following{/other_user}","gists_url":"https://api.github.com/users/ocheron/gists{/gist_id}","starred_url":"https://api.github.com/users/ocheron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocheron/subscriptions","organizations_url":"https://api.github.com/users/ocheron/orgs","repos_url":"https://api.github.com/users/ocheron/repos","events_url":"https://api.github.com/users/ocheron/events{/privacy}","received_events_url":"https://api.github.com/users/ocheron/received_events","type":"User","site_admin":false},"repo":{"id":67820922,"node_id":"MDEwOlJlcG9zaXRvcnk2NzgyMDkyMg==","name":"hs-tls","full_name":"ocheron/hs-tls","private":false,"owner":{"login":"ocheron","id":2415051,"node_id":"MDQ6VXNlcjI0MTUwNTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2415051?v=4","gravatar_id":"","url":"https://api.github.com/users/ocheron","html_url":"https://github.com/ocheron","followers_url":"https://api.github.com/users/ocheron/followers","following_url":"https://api.github.com/users/ocheron/following{/other_user}","gists_url":"https://api.github.com/users/ocheron/gists{/gist_id}","starred_url":"https://api.github.com/users/ocheron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocheron/subscriptions","organizations_url":"https://api.github.com/users/ocheron/orgs","repos_url":"https://api.github.com/users/ocheron/repos","events_url":"https://api.github.com/users/ocheron/events{/privacy}","received_events_url":"https://api.github.com/users/ocheron/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ocheron/hs-tls","description":"TLS/SSL implementation in haskell","fork":true,"url":"https://api.github.com/repos/ocheron/hs-tls","forks_url":"https://api.github.com/repos/ocheron/hs-tls/forks","keys_url":"https://api.github.com/repos/ocheron/hs-tls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocheron/hs-tls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocheron/hs-tls/teams","hooks_url":"https://api.github.com/repos/ocheron/hs-tls/hooks","issue_events_url":"https://api.github.com/repos/ocheron/hs-tls/issues/events{/number}","events_url":"https://api.github.com/repos/ocheron/hs-tls/events","assignees_url":"https://api.github.com/repos/ocheron/hs-tls/assignees{/user}","branches_url":"https://api.github.com/repos/ocheron/hs-tls/branches{/branch}","tags_url":"https://api.github.com/repos/ocheron/hs-tls/tags","blobs_url":"https://api.github.com/repos/ocheron/hs-tls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocheron/hs-tls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocheron/hs-tls/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocheron/hs-tls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocheron/hs-tls/statuses/{sha}","languages_url":"https://api.github.com/repos/ocheron/hs-tls/languages","stargazers_url":"https://api.github.com/repos/ocheron/hs-tls/stargazers","contributors_url":"https://api.github.com/repos/ocheron/hs-tls/contributors","subscribers_url":"https://api.github.com/repos/ocheron/hs-tls/subscribers","subscription_url":"https://api.github.com/repos/ocheron/hs-tls/subscription","commits_url":"https://api.github.com/repos/ocheron/hs-tls/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocheron/hs-tls/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocheron/hs-tls/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocheron/hs-tls/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocheron/hs-tls/contents/{+path}","compare_url":"https://api.github.com/repos/ocheron/hs-tls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocheron/hs-tls/merges","archive_url":"https://api.github.com/repos/ocheron/hs-tls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocheron/hs-tls/downloads","issues_url":"https://api.github.com/repos/ocheron/hs-tls/issues{/number}","pulls_url":"https://api.github.com/repos/ocheron/hs-tls/pulls{/number}","milestones_url":"https://api.github.com/repos/ocheron/hs-tls/milestones{/number}","notifications_url":"https://api.github.com/repos/ocheron/hs-tls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocheron/hs-tls/labels{/name}","releases_url":"https://api.github.com/repos/ocheron/hs-tls/releases{/id}","deployments_url":"https://api.github.com/repos/ocheron/hs-tls/deployments","created_at":"2016-09-09T17:59:58Z","updated_at":"2018-10-21T13:18:09Z","pushed_at":"2018-11-04T16:05:30Z","git_url":"git://github.com/ocheron/hs-tls.git","ssh_url":"git@github.com:ocheron/hs-tls.git","clone_url":"https://github.com/ocheron/hs-tls.git","svn_url":"https://github.com/ocheron/hs-tls","homepage":"","size":2668,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"vincenthz:master","ref":"master","sha":"543f76b5e62b6f1cde04099035698f98f50e9496","user":{"login":"vincenthz","id":174631,"node_id":"MDQ6VXNlcjE3NDYzMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/174631?v=4","gravatar_id":"","url":"https://api.github.com/users/vincenthz","html_url":"https://github.com/vincenthz","followers_url":"https://api.github.com/users/vincenthz/followers","following_url":"https://api.github.com/users/vincenthz/following{/other_user}","gists_url":"https://api.github.com/users/vincenthz/gists{/gist_id}","starred_url":"https://api.github.com/users/vincenthz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincenthz/subscriptions","organizations_url":"https://api.github.com/users/vincenthz/orgs","repos_url":"https://api.github.com/users/vincenthz/repos","events_url":"https://api.github.com/users/vincenthz/events{/privacy}","received_events_url":"https://api.github.com/users/vincenthz/received_events","type":"User","site_admin":false},"repo":{"id":899891,"node_id":"MDEwOlJlcG9zaXRvcnk4OTk4OTE=","name":"hs-tls","full_name":"vincenthz/hs-tls","private":false,"owner":{"login":"vincenthz","id":174631,"node_id":"MDQ6VXNlcjE3NDYzMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/174631?v=4","gravatar_id":"","url":"https://api.github.com/users/vincenthz","html_url":"https://github.com/vincenthz","followers_url":"https://api.github.com/users/vincenthz/followers","following_url":"https://api.github.com/users/vincenthz/following{/other_user}","gists_url":"https://api.github.com/users/vincenthz/gists{/gist_id}","starred_url":"https://api.github.com/users/vincenthz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincenthz/subscriptions","organizations_url":"https://api.github.com/users/vincenthz/orgs","repos_url":"https://api.github.com/users/vincenthz/repos","events_url":"https://api.github.com/users/vincenthz/events{/privacy}","received_events_url":"https://api.github.com/users/vincenthz/received_events","type":"User","site_admin":false},"html_url":"https://github.com/vincenthz/hs-tls","description":"TLS/SSL implementation in haskell","fork":false,"url":"https://api.github.com/repos/vincenthz/hs-tls","forks_url":"https://api.github.com/repos/vincenthz/hs-tls/forks","keys_url":"https://api.github.com/repos/vincenthz/hs-tls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vincenthz/hs-tls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vincenthz/hs-tls/teams","hooks_url":"https://api.github.com/repos/vincenthz/hs-tls/hooks","issue_events_url":"https://api.github.com/repos/vincenthz/hs-tls/issues/events{/number}","events_url":"https://api.github.com/repos/vincenthz/hs-tls/events","assignees_url":"https://api.github.com/repos/vincenthz/hs-tls/assignees{/user}","branches_url":"https://api.github.com/repos/vincenthz/hs-tls/branches{/branch}","tags_url":"https://api.github.com/repos/vincenthz/hs-tls/tags","blobs_url":"https://api.github.com/repos/vincenthz/hs-tls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vincenthz/hs-tls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vincenthz/hs-tls/git/refs{/sha}","trees_url":"https://api.github.com/repos/vincenthz/hs-tls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vincenthz/hs-tls/statuses/{sha}","languages_url":"https://api.github.com/repos/vincenthz/hs-tls/languages","stargazers_url":"https://api.github.com/repos/vincenthz/hs-tls/stargazers","contributors_url":"https://api.github.com/repos/vincenthz/hs-tls/contributors","subscribers_url":"https://api.github.com/repos/vincenthz/hs-tls/subscribers","subscription_url":"https://api.github.com/repos/vincenthz/hs-tls/subscription","commits_url":"https://api.github.com/repos/vincenthz/hs-tls/commits{/sha}","git_commits_url":"https://api.github.com/repos/vincenthz/hs-tls/git/commits{/sha}","comments_url":"https://api.github.com/repos/vincenthz/hs-tls/comments{/number}","issue_comment_url":"https://api.github.com/repos/vincenthz/hs-tls/issues/comments{/number}","contents_url":"https://api.github.com/repos/vincenthz/hs-tls/contents/{+path}","compare_url":"https://api.github.com/repos/vincenthz/hs-tls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vincenthz/hs-tls/merges","archive_url":"https://api.github.com/repos/vincenthz/hs-tls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vincenthz/hs-tls/downloads","issues_url":"https://api.github.com/repos/vincenthz/hs-tls/issues{/number}","pulls_url":"https://api.github.com/repos/vincenthz/hs-tls/pulls{/number}","milestones_url":"https://api.github.com/repos/vincenthz/hs-tls/milestones{/number}","notifications_url":"https://api.github.com/repos/vincenthz/hs-tls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vincenthz/hs-tls/labels{/name}","releases_url":"https://api.github.com/repos/vincenthz/hs-tls/releases{/id}","deployments_url":"https://api.github.com/repos/vincenthz/hs-tls/deployments","created_at":"2010-09-09T21:41:49Z","updated_at":"2018-10-21T12:58:16Z","pushed_at":"2018-11-05T13:30:12Z","git_url":"git://github.com/vincenthz/hs-tls.git","ssh_url":"git@github.com:vincenthz/hs-tls.git","clone_url":"https://github.com/vincenthz/hs-tls.git","svn_url":"https://github.com/vincenthz/hs-tls","homepage":"","size":2635,"stargazers_count":326,"watchers_count":326,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":70,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":70,"open_issues":42,"watchers":326,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274"},"html":{"href":"https://github.com/vincenthz/hs-tls/pull/274"},"issue":{"href":"https://api.github.com/repos/vincenthz/hs-tls/issues/274"},"comments":{"href":"https://api.github.com/repos/vincenthz/hs-tls/issues/274/comments"},"review_comments":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274/comments"},"review_comment":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vincenthz/hs-tls/pulls/274/commits"},"statuses":{"href":"https://api.github.com/repos/vincenthz/hs-tls/statuses/aeb89a83e9f4bd2b363a68f4411ac3a954c87ccf"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"vdukhovni"}}