{"action":"created","comment":{"url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/comments/231494702","pull_request_review_id":172474361,"id":231494702,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTQ5NDcwMg==","diff_hunk":"@@ -0,0 +1,111 @@\n+package com.r3.sgx.enclave.rng\n+\n+import com.r3.sgx.core.common.*\n+import com.r3.sgx.core.host.EnclaveHandle\n+import com.r3.sgx.core.host.EpidAttestationHostConfiguration\n+import com.r3.sgx.core.host.EpidAttestationHostHandler\n+import com.r3.sgx.core.host.NativeHostApi\n+import com.r3.sgx.core.host.internal.Native\n+import com.r3.sgx.testing.BytesRecordingHandler\n+import org.junit.After\n+import org.junit.Before\n+import org.junit.Test\n+import java.io.File\n+import java.nio.ByteBuffer\n+import java.security.MessageDigest\n+import java.security.SecureRandom\n+import kotlin.test.assertEquals\n+\n+class RngEnclaveTest {\n+    // The SGX gradle plugin sets this property to the path of the built+signed enclave.\n+    private val enclavePath = System.getProperty(\"com.r3.sgx.enclave.path\")\n+\n+    private lateinit var enclave: EnclaveHandle<RootHandler.Connected>\n+\n+    @Before\n+    fun setup() {\n+        enclave = NativeHostApi.createEnclave(RootHandler(), File(enclavePath))\n+    }\n+\n+    @After\n+    fun shutdown() {\n+        Native.destroyEnclave(enclave.enclaveId)\n+    }\n+\n+    @Test\n+    fun rngEnclaveWorks() {\n+        // A channel handler that records the binary blobs sent by the enclave.\n+        val handler = BytesRecordingHandler()\n+\n+        // Configure the host side of attestation. Insert your SPID/quote type if you want to test using a\n+        // non-Simulation enclave.\n+        val configuration = EpidAttestationHostConfiguration(\n+                quoteType = SgxQuoteType32.LINKABLE,\n+                spid = Cursor.allocate(SgxSpid)\n+        )\n+\n+        // Construct the host side of an Enclavelet, with channel and EPID attestation support\n+        val connected = enclave.connected\n+        val channels = connected.addDownstream(ChannelInitiatingHandler())\n+        val attesting = connected.addDownstream(EpidAttestationHostHandler(configuration))\n+\n+        // Create a quote, including the enclave's report data created by RngEnclave.createReportData, and signed by the\n+        // Quoting Enclave. Note that this test does *not* do a full attestation roundtrip to the Intel Attestation\n+        // Service!\n+        val quote = attesting.getQuote()\n+        val hashedEnclaveKey = quote[quote.type.quote][SgxQuote.reportBody][SgxReportBody.reportData].read()","path":"src/test/kotlin/com/r3/sgx/enclave/rng/RngEnclaveTest.kt","position":56,"original_position":56,"commit_id":"1739fd162004bbcfc9b6e1a689963608b4406dbd","original_commit_id":"1739fd162004bbcfc9b6e1a689963608b4406dbd","user":{"login":"mikehearn","id":971089,"node_id":"MDQ6VXNlcjk3MTA4OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/971089?v=4","gravatar_id":"","url":"https://api.github.com/users/mikehearn","html_url":"https://github.com/mikehearn","followers_url":"https://api.github.com/users/mikehearn/followers","following_url":"https://api.github.com/users/mikehearn/following{/other_user}","gists_url":"https://api.github.com/users/mikehearn/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehearn/subscriptions","organizations_url":"https://api.github.com/users/mikehearn/orgs","repos_url":"https://api.github.com/users/mikehearn/repos","events_url":"https://api.github.com/users/mikehearn/events{/privacy}","received_events_url":"https://api.github.com/users/mikehearn/received_events","type":"User","site_admin":false},"body":"?? Is this a JSON structure or something? More types would help here.","created_at":"2018-11-07T13:02:03Z","updated_at":"2018-11-07T13:05:40Z","html_url":"https://github.com/corda/oblivium-rng-enclave/pull/1#discussion_r231494702","pull_request_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/comments/231494702"},"html":{"href":"https://github.com/corda/oblivium-rng-enclave/pull/1#discussion_r231494702"},"pull_request":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1","id":227009875,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MDA5ODc1","html_url":"https://github.com/corda/oblivium-rng-enclave/pull/1","diff_url":"https://github.com/corda/oblivium-rng-enclave/pull/1.diff","patch_url":"https://github.com/corda/oblivium-rng-enclave/pull/1.patch","issue_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/1","number":1,"state":"open","locked":false,"title":"ENT-1909: First iteration of RngEnclavelet","user":{"login":"exFalso","id":1042674,"node_id":"MDQ6VXNlcjEwNDI2NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1042674?v=4","gravatar_id":"","url":"https://api.github.com/users/exFalso","html_url":"https://github.com/exFalso","followers_url":"https://api.github.com/users/exFalso/followers","following_url":"https://api.github.com/users/exFalso/following{/other_user}","gists_url":"https://api.github.com/users/exFalso/gists{/gist_id}","starred_url":"https://api.github.com/users/exFalso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exFalso/subscriptions","organizations_url":"https://api.github.com/users/exFalso/orgs","repos_url":"https://api.github.com/users/exFalso/repos","events_url":"https://api.github.com/users/exFalso/events{/privacy}","received_events_url":"https://api.github.com/users/exFalso/received_events","type":"User","site_admin":false},"body":"This PR is the first iteration of a simple RNG enclave showing how to build a JVM enclave. The enclave generates random bytes and signs over it with a key rooted in an attested quote.\r\n\r\nNote that the test is using Simulation libraries, so the quote isn't generated/checked. Followup task is to add tests that show how to do this, given sufficient hardware/attestation capabilities.\r\n\r\nThe enclave implements the `EnclaveletEnclave` class, which means it's compatible with the enclavelet host infrastructure.","created_at":"2018-10-30T17:15:41Z","updated_at":"2018-11-07T13:05:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9abba4509a4a2962bf7b90c8b0b87cbabe497d32","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1/commits","review_comments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1/comments","review_comment_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/comments{/number}","comments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/1/comments","statuses_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/statuses/1739fd162004bbcfc9b6e1a689963608b4406dbd","head":{"label":"corda:ENT-1909/aslemmer-rng-enclavelet","ref":"ENT-1909/aslemmer-rng-enclavelet","sha":"1739fd162004bbcfc9b6e1a689963608b4406dbd","user":{"login":"corda","id":22600631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjAwNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":153805055,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM4MDUwNTU=","name":"oblivium-rng-enclave","full_name":"corda/oblivium-rng-enclave","private":false,"owner":{"login":"corda","id":22600631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjAwNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/corda/oblivium-rng-enclave","description":"An RNG enclave generating random numbers","fork":false,"url":"https://api.github.com/repos/corda/oblivium-rng-enclave","forks_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/forks","keys_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/teams","hooks_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/hooks","issue_events_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/events{/number}","events_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/events","assignees_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/assignees{/user}","branches_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/branches{/branch}","tags_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/tags","blobs_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/languages","stargazers_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/stargazers","contributors_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/contributors","subscribers_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/subscribers","subscription_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/subscription","commits_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/contents/{+path}","compare_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/merges","archive_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/downloads","issues_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues{/number}","pulls_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/labels{/name}","releases_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/releases{/id}","deployments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/deployments","created_at":"2018-10-19T15:34:12Z","updated_at":"2018-10-30T15:41:24Z","pushed_at":"2018-11-05T16:50:48Z","git_url":"git://github.com/corda/oblivium-rng-enclave.git","ssh_url":"git@github.com:corda/oblivium-rng-enclave.git","clone_url":"https://github.com/corda/oblivium-rng-enclave.git","svn_url":"https://github.com/corda/oblivium-rng-enclave","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"corda:master","ref":"master","sha":"8eb8c6d14a36af38060d397383da11bff4569731","user":{"login":"corda","id":22600631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjAwNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":153805055,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM4MDUwNTU=","name":"oblivium-rng-enclave","full_name":"corda/oblivium-rng-enclave","private":false,"owner":{"login":"corda","id":22600631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjAwNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/corda/oblivium-rng-enclave","description":"An RNG enclave generating random numbers","fork":false,"url":"https://api.github.com/repos/corda/oblivium-rng-enclave","forks_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/forks","keys_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/teams","hooks_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/hooks","issue_events_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/events{/number}","events_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/events","assignees_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/assignees{/user}","branches_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/branches{/branch}","tags_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/tags","blobs_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/languages","stargazers_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/stargazers","contributors_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/contributors","subscribers_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/subscribers","subscription_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/subscription","commits_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/contents/{+path}","compare_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/merges","archive_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/downloads","issues_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues{/number}","pulls_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/labels{/name}","releases_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/releases{/id}","deployments_url":"https://api.github.com/repos/corda/oblivium-rng-enclave/deployments","created_at":"2018-10-19T15:34:12Z","updated_at":"2018-10-30T15:41:24Z","pushed_at":"2018-11-05T16:50:48Z","git_url":"git://github.com/corda/oblivium-rng-enclave.git","ssh_url":"git@github.com:corda/oblivium-rng-enclave.git","clone_url":"https://github.com/corda/oblivium-rng-enclave.git","svn_url":"https://github.com/corda/oblivium-rng-enclave","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1"},"html":{"href":"https://github.com/corda/oblivium-rng-enclave/pull/1"},"issue":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/1"},"comments":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/corda/oblivium-rng-enclave/statuses/1739fd162004bbcfc9b6e1a689963608b4406dbd"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mikehearn"}}