GitHub PullRequestReviewCommentEvent at 2014-02-10 21:21:19
Repository: cryptography
Actor: reaperhulk
Payload: {"comment":{"url":"https://api.github.com/repos/pyca/cryptography/pulls/comments/9602351","id":9602351,"diff_hunk":"@@ -259,6 +261,43 @@ def _handle_error_code(self, code):\n             )\n         )\n \n+    def _bn_to_int(self, bn):\n+        hex_cdata = self._lib.BN_bn2hex(bn)\n+        assert hex_cdata != self._ffi.NULL\n+        hex_str = self._ffi.string(hex_cdata)\n+        self._lib.OPENSSL_free(hex_cdata)\n+        return int(hex_str, 16)\n+\n+    def generate_rsa_private_key(self, public_exponent, key_size):","path":"cryptography/hazmat/backends/openssl/backend.py","position":35,"original_position":35,"commit_id":"75e9560583c8018815e45abd2277413261a69584","original_commit_id":"75e9560583c8018815e45abd2277413261a69584","user":{"login":"reaperhulk","id":161495,"avatar_url":"https://gravatar.com/avatar/81f310942fe5989105a6b474cda4c843?d=https%3A%2F%2Fidenticons.github.com%2F472b5d9f2faf67614e39fc24c2aeca99.png&r=x","gravatar_id":"81f310942fe5989105a6b474cda4c843","url":"https://api.github.com/users/reaperhulk","html_url":"https://github.com/reaperhulk","followers_url":"https://api.github.com/users/reaperhulk/followers","following_url":"https://api.github.com/users/reaperhulk/following{/other_user}","gists_url":"https://api.github.com/users/reaperhulk/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperhulk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperhulk/subscriptions","organizations_url":"https://api.github.com/users/reaperhulk/orgs","repos_url":"https://api.github.com/users/reaperhulk/repos","events_url":"https://api.github.com/users/reaperhulk/events{/privacy}","received_events_url":"https://api.github.com/users/reaperhulk/received_events","type":"User","site_admin":false},"body":"Interesting question. I think we should keep checks in the backend to prevent the user from passing parameters that can cause the underlying library to hang/crash, so some checks on the public_exponent are needed (OpenSSL will hang forever trying to generate if you pass an even public_exponent). Of course, it can also die with very small key sizes (or very large) so we may need backend specific logic there?\r\n\r\n@public, opinions? I remember you originally advocated in IRC for any minimum being enforced in the backends rather than up in #582.","created_at":"2014-02-10T21:21:19Z","updated_at":"2014-02-10T21:21:19Z","html_url":"https://github.com/pyca/cryptography/pull/580#discussion_r9602351","pull_request_url":"https://api.github.com/repos/pyca/cryptography/pulls/580","_links":{"self":{"href":"https://api.github.com/repos/pyca/cryptography/pulls/comments/9602351"},"html":{"href":"https://github.com/pyca/cryptography/pull/580#discussion_r9602351"},"pull_request":{"href":"https://api.github.com/repos/pyca/cryptography/pulls/580"}}}}