{"action":"created","comment":{"url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/comments/279209189","pull_request_review_id":231483141,"id":279209189,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3OTIwOTE4OQ==","diff_hunk":"@@ -112,3 +112,115 @@\n   end\n end # Rnp.symmetric_encrypt\n \n+describe Rnp.instance_method(:encrypt_and_sign) do\n+  before do\n+    rnp = Rnp.new\n+    rnp.load_keys(\n+      format: \"GPG\",\n+      input: Rnp::Input.from_path(\"spec/data/keyrings/gpg/pubring.gpg\")\n+    )\n+    rnp.load_keys(\n+      format: \"GPG\",\n+      input: Rnp::Input.from_path(\"spec/data/keyrings/gpg/secring.gpg\")\n+    )\n+    recipient = rnp.find_key(userid: \"key0-uid0\")\n+\n+    sender = rnp.find_key(userid: \"key1-uid2\")\n+    sender.unlock(\"password\")\n+\n+    # write some random-length plaintext\n+    @plaintext = SecureRandom.hex(rand(1..(32768 * 3))).freeze\n+    plaintextf = Tempfile.new([\"ruby-rnp\", \".txt\"])\n+    plaintextf.write(@plaintext)\n+    plaintextf.close\n+\n+    @encryptedf = Tempfile.new([\"ruby-rnp\", \".gpg\"])\n+    rnp.encrypt_and_sign(\n+      recipients: recipient,\n+      signers: sender,\n+      input: Rnp::Input.from_path(plaintextf.path),\n+      output: Rnp::Output.to_path(@encryptedf.path)\n+    )\n+  end\n+\n+  it \"raises an error when not provided the key\" do\n+    rnp = Rnp.new\n+    decryptedf = Tempfile.new(\"ruby-rnp\")\n+    expect {\n+      rnp.decrypt(\n+        input: Rnp::Input.from_path(@encryptedf.path),\n+        output: Rnp::Output.to_path(decryptedf.path)\n+      )\n+    }.to raise_error(Rnp::NoSuitableKeyError)\n+  end\n+\n+  it \"requests the correct key for decrypting\" do\n+    rnp = Rnp.new\n+    rnp.key_provider = lambda do |idtype, id, secret|\n+      expect(idtype).to eql \"keyid\"\n+      expect(id).to eql \"1ED63EE56FADC34D\"\n+      expect(secret).to eql true\n+      rnp.load_keys(\n+        format: \"GPG\",\n+        input: Rnp::Input.from_path(\"spec/data/keyrings/gpg/secring.gpg\")\n+      )\n+    end\n+    decryptedf = Tempfile.new(\"ruby-rnp\")\n+    expect do\n+      rnp.decrypt(\n+        input: Rnp::Input.from_path(@encryptedf.path),\n+        output: Rnp::Output.to_path(decryptedf.path)\n+      )\n+    end.to raise_error(Rnp::BadPasswordError)\n+  end\n+\n+  it \"raises an error when not provided a password\" do\n+    rnp = Rnp.new\n+    rnp.load_keys(\n+      format: \"GPG\",\n+      input: Rnp::Input.from_path(\"spec/data/keyrings/gpg/secring.gpg\")\n+    )\n+    decryptedf = Tempfile.new(\"ruby-rnp\")\n+    expect do\n+      rnp.decrypt(\n+        input: Rnp::Input.from_path(@encryptedf.path),\n+        output: Rnp::Output.to_path(decryptedf.path)\n+      )\n+    end.to raise_error(Rnp::BadPasswordError)\n+  end\n+\n+  it \"decrypts to the original plaintext\" do\n+    rnp = Rnp.new\n+    rnp.load_keys(\n+      format: \"GPG\",\n+      input: Rnp::Input.from_path(\"spec/data/keyrings/gpg/secring.gpg\")\n+    )\n+    rnp.password_provider = lambda do |key, reason|\n+      expect(key.keyid).to eql \"1ED63EE56FADC34D\"\n+      expect(reason).to eql \"decrypt\"\n+      \"password\"\n+    end\n+    decryptedf = Tempfile.new(\"ruby-rnp\", encoding: Encoding::BINARY)\n+    rnp.decrypt(\n+      input: Rnp::Input.from_io(@encryptedf),\n+      output: Rnp::Output.to_path(decryptedf.path)","path":"spec/encrypt/simple_encrypt_spec.rb","position":95,"original_position":95,"commit_id":"087161824d8b9ca66ec925cb742c9697bea5f7bb","original_commit_id":"087161824d8b9ca66ec925cb742c9697bea5f7bb","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Put a comma after the last parameter of a multiline method call.","created_at":"2019-04-28T19:41:29Z","updated_at":"2019-04-28T19:41:31Z","html_url":"https://github.com/riboseinc/ruby-rnp/pull/52#discussion_r279209189","pull_request_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/comments/279209189"},"html":{"href":"https://github.com/riboseinc/ruby-rnp/pull/52#discussion_r279209189"},"pull_request":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52","id":274203549,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc0MjAzNTQ5","html_url":"https://github.com/riboseinc/ruby-rnp/pull/52","diff_url":"https://github.com/riboseinc/ruby-rnp/pull/52.diff","patch_url":"https://github.com/riboseinc/ruby-rnp/pull/52.patch","issue_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/52","number":52,"state":"open","locked":false,"title":"tests: Add encrypt_and_sign tests.","user":{"login":"dewyatt","id":711649,"node_id":"MDQ6VXNlcjcxMTY0OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/711649?v=4","gravatar_id":"","url":"https://api.github.com/users/dewyatt","html_url":"https://github.com/dewyatt","followers_url":"https://api.github.com/users/dewyatt/followers","following_url":"https://api.github.com/users/dewyatt/following{/other_user}","gists_url":"https://api.github.com/users/dewyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/dewyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dewyatt/subscriptions","organizations_url":"https://api.github.com/users/dewyatt/orgs","repos_url":"https://api.github.com/users/dewyatt/repos","events_url":"https://api.github.com/users/dewyatt/events{/privacy}","received_events_url":"https://api.github.com/users/dewyatt/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-04-28T19:41:22Z","updated_at":"2019-04-28T19:41:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a0a8a093d02cb4648f7d8386106fab776e5026a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52/commits","review_comments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52/comments","review_comment_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/52/comments","statuses_url":"https://api.github.com/repos/riboseinc/ruby-rnp/statuses/087161824d8b9ca66ec925cb742c9697bea5f7bb","head":{"label":"riboseinc:dewyatt-add-encrypt_and_sign-tests","ref":"dewyatt-add-encrypt_and_sign-tests","sha":"087161824d8b9ca66ec925cb742c9697bea5f7bb","user":{"login":"riboseinc","id":24904375,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTA0Mzc1","avatar_url":"https://avatars0.githubusercontent.com/u/24904375?v=4","gravatar_id":"","url":"https://api.github.com/users/riboseinc","html_url":"https://github.com/riboseinc","followers_url":"https://api.github.com/users/riboseinc/followers","following_url":"https://api.github.com/users/riboseinc/following{/other_user}","gists_url":"https://api.github.com/users/riboseinc/gists{/gist_id}","starred_url":"https://api.github.com/users/riboseinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riboseinc/subscriptions","organizations_url":"https://api.github.com/users/riboseinc/orgs","repos_url":"https://api.github.com/users/riboseinc/repos","events_url":"https://api.github.com/users/riboseinc/events{/privacy}","received_events_url":"https://api.github.com/users/riboseinc/received_events","type":"Organization","site_admin":false},"repo":{"id":86398198,"node_id":"MDEwOlJlcG9zaXRvcnk4NjM5ODE5OA==","name":"ruby-rnp","full_name":"riboseinc/ruby-rnp","private":false,"owner":{"login":"riboseinc","id":24904375,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTA0Mzc1","avatar_url":"https://avatars0.githubusercontent.com/u/24904375?v=4","gravatar_id":"","url":"https://api.github.com/users/riboseinc","html_url":"https://github.com/riboseinc","followers_url":"https://api.github.com/users/riboseinc/followers","following_url":"https://api.github.com/users/riboseinc/following{/other_user}","gists_url":"https://api.github.com/users/riboseinc/gists{/gist_id}","starred_url":"https://api.github.com/users/riboseinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riboseinc/subscriptions","organizations_url":"https://api.github.com/users/riboseinc/orgs","repos_url":"https://api.github.com/users/riboseinc/repos","events_url":"https://api.github.com/users/riboseinc/events{/privacy}","received_events_url":"https://api.github.com/users/riboseinc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/riboseinc/ruby-rnp","description":"Ruby bindings for the `rnp` OpenPGP library","fork":false,"url":"https://api.github.com/repos/riboseinc/ruby-rnp","forks_url":"https://api.github.com/repos/riboseinc/ruby-rnp/forks","keys_url":"https://api.github.com/repos/riboseinc/ruby-rnp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riboseinc/ruby-rnp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riboseinc/ruby-rnp/teams","hooks_url":"https://api.github.com/repos/riboseinc/ruby-rnp/hooks","issue_events_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/events{/number}","events_url":"https://api.github.com/repos/riboseinc/ruby-rnp/events","assignees_url":"https://api.github.com/repos/riboseinc/ruby-rnp/assignees{/user}","branches_url":"https://api.github.com/repos/riboseinc/ruby-rnp/branches{/branch}","tags_url":"https://api.github.com/repos/riboseinc/ruby-rnp/tags","blobs_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/refs{/sha}","trees_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riboseinc/ruby-rnp/statuses/{sha}","languages_url":"https://api.github.com/repos/riboseinc/ruby-rnp/languages","stargazers_url":"https://api.github.com/repos/riboseinc/ruby-rnp/stargazers","contributors_url":"https://api.github.com/repos/riboseinc/ruby-rnp/contributors","subscribers_url":"https://api.github.com/repos/riboseinc/ruby-rnp/subscribers","subscription_url":"https://api.github.com/repos/riboseinc/ruby-rnp/subscription","commits_url":"https://api.github.com/repos/riboseinc/ruby-rnp/commits{/sha}","git_commits_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/commits{/sha}","comments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/comments{/number}","issue_comment_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/comments{/number}","contents_url":"https://api.github.com/repos/riboseinc/ruby-rnp/contents/{+path}","compare_url":"https://api.github.com/repos/riboseinc/ruby-rnp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riboseinc/ruby-rnp/merges","archive_url":"https://api.github.com/repos/riboseinc/ruby-rnp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riboseinc/ruby-rnp/downloads","issues_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues{/number}","pulls_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls{/number}","milestones_url":"https://api.github.com/repos/riboseinc/ruby-rnp/milestones{/number}","notifications_url":"https://api.github.com/repos/riboseinc/ruby-rnp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riboseinc/ruby-rnp/labels{/name}","releases_url":"https://api.github.com/repos/riboseinc/ruby-rnp/releases{/id}","deployments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/deployments","created_at":"2017-03-28T00:44:25Z","updated_at":"2019-04-27T18:09:50Z","pushed_at":"2019-04-28T19:41:23Z","git_url":"git://github.com/riboseinc/ruby-rnp.git","ssh_url":"git@github.com:riboseinc/ruby-rnp.git","clone_url":"https://github.com/riboseinc/ruby-rnp.git","svn_url":"https://github.com/riboseinc/ruby-rnp","homepage":"https://www.ribose.com","size":219,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":7,"watchers":3,"default_branch":"master"}},"base":{"label":"riboseinc:master","ref":"master","sha":"8c4d132ff052b9f9a49d0afa57a48e28a3c59904","user":{"login":"riboseinc","id":24904375,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTA0Mzc1","avatar_url":"https://avatars0.githubusercontent.com/u/24904375?v=4","gravatar_id":"","url":"https://api.github.com/users/riboseinc","html_url":"https://github.com/riboseinc","followers_url":"https://api.github.com/users/riboseinc/followers","following_url":"https://api.github.com/users/riboseinc/following{/other_user}","gists_url":"https://api.github.com/users/riboseinc/gists{/gist_id}","starred_url":"https://api.github.com/users/riboseinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riboseinc/subscriptions","organizations_url":"https://api.github.com/users/riboseinc/orgs","repos_url":"https://api.github.com/users/riboseinc/repos","events_url":"https://api.github.com/users/riboseinc/events{/privacy}","received_events_url":"https://api.github.com/users/riboseinc/received_events","type":"Organization","site_admin":false},"repo":{"id":86398198,"node_id":"MDEwOlJlcG9zaXRvcnk4NjM5ODE5OA==","name":"ruby-rnp","full_name":"riboseinc/ruby-rnp","private":false,"owner":{"login":"riboseinc","id":24904375,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTA0Mzc1","avatar_url":"https://avatars0.githubusercontent.com/u/24904375?v=4","gravatar_id":"","url":"https://api.github.com/users/riboseinc","html_url":"https://github.com/riboseinc","followers_url":"https://api.github.com/users/riboseinc/followers","following_url":"https://api.github.com/users/riboseinc/following{/other_user}","gists_url":"https://api.github.com/users/riboseinc/gists{/gist_id}","starred_url":"https://api.github.com/users/riboseinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riboseinc/subscriptions","organizations_url":"https://api.github.com/users/riboseinc/orgs","repos_url":"https://api.github.com/users/riboseinc/repos","events_url":"https://api.github.com/users/riboseinc/events{/privacy}","received_events_url":"https://api.github.com/users/riboseinc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/riboseinc/ruby-rnp","description":"Ruby bindings for the `rnp` OpenPGP library","fork":false,"url":"https://api.github.com/repos/riboseinc/ruby-rnp","forks_url":"https://api.github.com/repos/riboseinc/ruby-rnp/forks","keys_url":"https://api.github.com/repos/riboseinc/ruby-rnp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riboseinc/ruby-rnp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riboseinc/ruby-rnp/teams","hooks_url":"https://api.github.com/repos/riboseinc/ruby-rnp/hooks","issue_events_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/events{/number}","events_url":"https://api.github.com/repos/riboseinc/ruby-rnp/events","assignees_url":"https://api.github.com/repos/riboseinc/ruby-rnp/assignees{/user}","branches_url":"https://api.github.com/repos/riboseinc/ruby-rnp/branches{/branch}","tags_url":"https://api.github.com/repos/riboseinc/ruby-rnp/tags","blobs_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/refs{/sha}","trees_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riboseinc/ruby-rnp/statuses/{sha}","languages_url":"https://api.github.com/repos/riboseinc/ruby-rnp/languages","stargazers_url":"https://api.github.com/repos/riboseinc/ruby-rnp/stargazers","contributors_url":"https://api.github.com/repos/riboseinc/ruby-rnp/contributors","subscribers_url":"https://api.github.com/repos/riboseinc/ruby-rnp/subscribers","subscription_url":"https://api.github.com/repos/riboseinc/ruby-rnp/subscription","commits_url":"https://api.github.com/repos/riboseinc/ruby-rnp/commits{/sha}","git_commits_url":"https://api.github.com/repos/riboseinc/ruby-rnp/git/commits{/sha}","comments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/comments{/number}","issue_comment_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/comments{/number}","contents_url":"https://api.github.com/repos/riboseinc/ruby-rnp/contents/{+path}","compare_url":"https://api.github.com/repos/riboseinc/ruby-rnp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riboseinc/ruby-rnp/merges","archive_url":"https://api.github.com/repos/riboseinc/ruby-rnp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riboseinc/ruby-rnp/downloads","issues_url":"https://api.github.com/repos/riboseinc/ruby-rnp/issues{/number}","pulls_url":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls{/number}","milestones_url":"https://api.github.com/repos/riboseinc/ruby-rnp/milestones{/number}","notifications_url":"https://api.github.com/repos/riboseinc/ruby-rnp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riboseinc/ruby-rnp/labels{/name}","releases_url":"https://api.github.com/repos/riboseinc/ruby-rnp/releases{/id}","deployments_url":"https://api.github.com/repos/riboseinc/ruby-rnp/deployments","created_at":"2017-03-28T00:44:25Z","updated_at":"2019-04-27T18:09:50Z","pushed_at":"2019-04-28T19:41:23Z","git_url":"git://github.com/riboseinc/ruby-rnp.git","ssh_url":"git@github.com:riboseinc/ruby-rnp.git","clone_url":"https://github.com/riboseinc/ruby-rnp.git","svn_url":"https://github.com/riboseinc/ruby-rnp","homepage":"https://www.ribose.com","size":219,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":7,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52"},"html":{"href":"https://github.com/riboseinc/ruby-rnp/pull/52"},"issue":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/52"},"comments":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/riboseinc/ruby-rnp/statuses/087161824d8b9ca66ec925cb742c9697bea5f7bb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}