{"action":"created","comment":{"url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/comments/44223276","id":44223276,"diff_hunk":"@@ -0,0 +1,51 @@\n+{-|\n+  Module:      Network.Ricochet.Crypto\n+  Description: Cryptographic primitives used internally by the library\n+\n+Since the cryptography libraries for haskell aren’t that great, we didn’t find\n+everything we need.  This module is a wrapper around the libraries we use, and\n+adds our own implementations/bindings of primitives that aren’t defined\n+elsewhere.\n+-}\n+\n+module Network.Ricochet.Crypto\n+  ( module Network.Ricochet.Crypto.RSA\n+  , generate1024BitRSA\n+  , base64EncodePrivRSA\n+  , hmacSHA256\n+  , rsaSign\n+  )\n+where\n+\n+import           Network.Ricochet.Crypto.RSA\n+\n+import           Data.ByteString            (ByteString)\n+import           Data.Maybe                 (fromJust)\n+import           OpenSSL                    (withOpenSSL)\n+import           OpenSSL.EVP.Base64         (encodeBase64BS)\n+import           OpenSSL.EVP.Digest         (Digest, getDigestByName, hmacBS)\n+import           OpenSSL.EVP.Sign           (signBS)\n+import           OpenSSL.RSA                (RSAKeyPair, generateRSAKey')\n+import           System.IO.Unsafe           (unsafePerformIO)\n+\n+-- | Generate a 1024 bit private RSA key.  The public exponent is 3.\n+generate1024BitRSA :: IO RSAKeyPair\n+generate1024BitRSA = generateRSAKey' 1024 3\n+\n+-- | Encode a private RSA key in DER and then Base64\n+base64EncodePrivRSA :: RSAKeyPair -> ByteString\n+base64EncodePrivRSA = encodeBase64BS . toDERPriv\n+\n+-- | The SHA256 Hash algorithm\n+sha256 :: Digest\n+sha256 = fromJust . unsafePerformIO . withOpenSSL $ getDigestByName \"SHA256\"","path":"src/Network/Ricochet/Crypto.hs","position":41,"original_position":41,"commit_id":"783a4d976622e5d2a88e15766120cb3f32d2da63","original_commit_id":"783a4d976622e5d2a88e15766120cb3f32d2da63","user":{"login":"lukasepple","id":3154475,"avatar_url":"https://avatars.githubusercontent.com/u/3154475?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasepple","html_url":"https://github.com/lukasepple","followers_url":"https://api.github.com/users/lukasepple/followers","following_url":"https://api.github.com/users/lukasepple/following{/other_user}","gists_url":"https://api.github.com/users/lukasepple/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasepple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasepple/subscriptions","organizations_url":"https://api.github.com/users/lukasepple/orgs","repos_url":"https://api.github.com/users/lukasepple/repos","events_url":"https://api.github.com/users/lukasepple/events{/privacy}","received_events_url":"https://api.github.com/users/lukasepple/received_events","type":"User","site_admin":false},"body":"I know, just the first time I see it actually being used :D","created_at":"2015-11-08T10:23:49Z","updated_at":"2015-11-08T10:23:49Z","html_url":"https://github.com/Jugendhackt/haskell-ricochet/pull/40#discussion_r44223276","pull_request_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/comments/44223276"},"html":{"href":"https://github.com/Jugendhackt/haskell-ricochet/pull/40#discussion_r44223276"},"pull_request":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40","id":50046798,"html_url":"https://github.com/Jugendhackt/haskell-ricochet/pull/40","diff_url":"https://github.com/Jugendhackt/haskell-ricochet/pull/40.diff","patch_url":"https://github.com/Jugendhackt/haskell-ricochet/pull/40.patch","issue_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/40","number":40,"state":"open","locked":false,"title":"Add wrapper module for cryptographic primitives","user":{"login":"shak-mar","id":7189441,"avatar_url":"https://avatars.githubusercontent.com/u/7189441?v=3","gravatar_id":"","url":"https://api.github.com/users/shak-mar","html_url":"https://github.com/shak-mar","followers_url":"https://api.github.com/users/shak-mar/followers","following_url":"https://api.github.com/users/shak-mar/following{/other_user}","gists_url":"https://api.github.com/users/shak-mar/gists{/gist_id}","starred_url":"https://api.github.com/users/shak-mar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shak-mar/subscriptions","organizations_url":"https://api.github.com/users/shak-mar/orgs","repos_url":"https://api.github.com/users/shak-mar/repos","events_url":"https://api.github.com/users/shak-mar/events{/privacy}","received_events_url":"https://api.github.com/users/shak-mar/received_events","type":"User","site_admin":false},"body":"Fixes #29.  I think this is everything we need.  Do you see something I missed?","created_at":"2015-11-07T22:18:56Z","updated_at":"2015-11-08T10:23:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"35029813600a032059df239358379b976b0523dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40/commits","review_comments_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40/comments","review_comment_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/40/comments","statuses_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/statuses/783a4d976622e5d2a88e15766120cb3f32d2da63","head":{"label":"Jugendhackt:crypto","ref":"crypto","sha":"783a4d976622e5d2a88e15766120cb3f32d2da63","user":{"login":"Jugendhackt","id":5402446,"avatar_url":"https://avatars.githubusercontent.com/u/5402446?v=3","gravatar_id":"","url":"https://api.github.com/users/Jugendhackt","html_url":"https://github.com/Jugendhackt","followers_url":"https://api.github.com/users/Jugendhackt/followers","following_url":"https://api.github.com/users/Jugendhackt/following{/other_user}","gists_url":"https://api.github.com/users/Jugendhackt/gists{/gist_id}","starred_url":"https://api.github.com/users/Jugendhackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jugendhackt/subscriptions","organizations_url":"https://api.github.com/users/Jugendhackt/orgs","repos_url":"https://api.github.com/users/Jugendhackt/repos","events_url":"https://api.github.com/users/Jugendhackt/events{/privacy}","received_events_url":"https://api.github.com/users/Jugendhackt/received_events","type":"Organization","site_admin":false},"repo":{"id":44426930,"name":"haskell-ricochet","full_name":"Jugendhackt/haskell-ricochet","owner":{"login":"Jugendhackt","id":5402446,"avatar_url":"https://avatars.githubusercontent.com/u/5402446?v=3","gravatar_id":"","url":"https://api.github.com/users/Jugendhackt","html_url":"https://github.com/Jugendhackt","followers_url":"https://api.github.com/users/Jugendhackt/followers","following_url":"https://api.github.com/users/Jugendhackt/following{/other_user}","gists_url":"https://api.github.com/users/Jugendhackt/gists{/gist_id}","starred_url":"https://api.github.com/users/Jugendhackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jugendhackt/subscriptions","organizations_url":"https://api.github.com/users/Jugendhackt/orgs","repos_url":"https://api.github.com/users/Jugendhackt/repos","events_url":"https://api.github.com/users/Jugendhackt/events{/privacy}","received_events_url":"https://api.github.com/users/Jugendhackt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jugendhackt/haskell-ricochet","description":"(WIP/Experimental) Ricochet implementation as Haskell Library.","fork":false,"url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet","forks_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/forks","keys_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/teams","hooks_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/hooks","issue_events_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/events{/number}","events_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/events","assignees_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/assignees{/user}","branches_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/branches{/branch}","tags_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/tags","blobs_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/statuses/{sha}","languages_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/languages","stargazers_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/stargazers","contributors_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/contributors","subscribers_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/subscribers","subscription_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/subscription","commits_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/contents/{+path}","compare_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/merges","archive_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/downloads","issues_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues{/number}","pulls_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls{/number}","milestones_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/milestones{/number}","notifications_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/labels{/name}","releases_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/releases{/id}","created_at":"2015-10-17T06:46:54Z","updated_at":"2015-11-08T00:56:28Z","pushed_at":"2015-11-08T01:16:50Z","git_url":"git://github.com/Jugendhackt/haskell-ricochet.git","ssh_url":"git@github.com:Jugendhackt/haskell-ricochet.git","clone_url":"https://github.com/Jugendhackt/haskell-ricochet.git","svn_url":"https://github.com/Jugendhackt/haskell-ricochet","homepage":"","size":502,"stargazers_count":17,"watchers_count":17,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":17,"default_branch":"master"}},"base":{"label":"Jugendhackt:master","ref":"master","sha":"e260da489eb2ad90cd3544e3dccbd5dfe7f607ea","user":{"login":"Jugendhackt","id":5402446,"avatar_url":"https://avatars.githubusercontent.com/u/5402446?v=3","gravatar_id":"","url":"https://api.github.com/users/Jugendhackt","html_url":"https://github.com/Jugendhackt","followers_url":"https://api.github.com/users/Jugendhackt/followers","following_url":"https://api.github.com/users/Jugendhackt/following{/other_user}","gists_url":"https://api.github.com/users/Jugendhackt/gists{/gist_id}","starred_url":"https://api.github.com/users/Jugendhackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jugendhackt/subscriptions","organizations_url":"https://api.github.com/users/Jugendhackt/orgs","repos_url":"https://api.github.com/users/Jugendhackt/repos","events_url":"https://api.github.com/users/Jugendhackt/events{/privacy}","received_events_url":"https://api.github.com/users/Jugendhackt/received_events","type":"Organization","site_admin":false},"repo":{"id":44426930,"name":"haskell-ricochet","full_name":"Jugendhackt/haskell-ricochet","owner":{"login":"Jugendhackt","id":5402446,"avatar_url":"https://avatars.githubusercontent.com/u/5402446?v=3","gravatar_id":"","url":"https://api.github.com/users/Jugendhackt","html_url":"https://github.com/Jugendhackt","followers_url":"https://api.github.com/users/Jugendhackt/followers","following_url":"https://api.github.com/users/Jugendhackt/following{/other_user}","gists_url":"https://api.github.com/users/Jugendhackt/gists{/gist_id}","starred_url":"https://api.github.com/users/Jugendhackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jugendhackt/subscriptions","organizations_url":"https://api.github.com/users/Jugendhackt/orgs","repos_url":"https://api.github.com/users/Jugendhackt/repos","events_url":"https://api.github.com/users/Jugendhackt/events{/privacy}","received_events_url":"https://api.github.com/users/Jugendhackt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jugendhackt/haskell-ricochet","description":"(WIP/Experimental) Ricochet implementation as Haskell Library.","fork":false,"url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet","forks_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/forks","keys_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/teams","hooks_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/hooks","issue_events_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/events{/number}","events_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/events","assignees_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/assignees{/user}","branches_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/branches{/branch}","tags_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/tags","blobs_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/statuses/{sha}","languages_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/languages","stargazers_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/stargazers","contributors_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/contributors","subscribers_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/subscribers","subscription_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/subscription","commits_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/contents/{+path}","compare_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/merges","archive_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/downloads","issues_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues{/number}","pulls_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls{/number}","milestones_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/milestones{/number}","notifications_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/labels{/name}","releases_url":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/releases{/id}","created_at":"2015-10-17T06:46:54Z","updated_at":"2015-11-08T00:56:28Z","pushed_at":"2015-11-08T01:16:50Z","git_url":"git://github.com/Jugendhackt/haskell-ricochet.git","ssh_url":"git@github.com:Jugendhackt/haskell-ricochet.git","clone_url":"https://github.com/Jugendhackt/haskell-ricochet.git","svn_url":"https://github.com/Jugendhackt/haskell-ricochet","homepage":"","size":502,"stargazers_count":17,"watchers_count":17,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40"},"html":{"href":"https://github.com/Jugendhackt/haskell-ricochet/pull/40"},"issue":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/40"},"comments":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/Jugendhackt/haskell-ricochet/statuses/783a4d976622e5d2a88e15766120cb3f32d2da63"}}}}