<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Thank you for replying. in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150625#M2558</link>
    <description>&lt;P&gt;Thank you for replying.&lt;/P&gt;

&lt;P&gt;I didn't notice that I can call another function in enclave from enclave function... Now maybe I can implement those secure sealing/unsealing features. Thanks for noticing me.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2017 15:03:02 GMT</pubDate>
    <dc:creator>aos</dc:creator>
    <dc:date>2017-11-06T15:03:02Z</dc:date>
    <item>
      <title>How can I seal/unseal data without compromised by untrusted area</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150622#M2555</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;

&lt;P&gt;I'm now developing application with SGX features, but I have several questions about sealing/unsealing. I hardly understand how to treat those features, so please forgive my poor questions.&lt;/P&gt;

&lt;P&gt;1. I would like to seal encryption key in enclave on my application. I (maybe) already succeeded to seal a value returned from ECALL function like this(written on untrusted code):&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//ECALL. Pass pointer to std::vector&amp;lt;int&amp;gt; which already initialized and return their average as int with &amp;amp;retval.
int retval; //value to get return value from ECALL function
sgx_status_t status = AVG_IN_ENCLAVE(global_eid, &amp;amp;retval, (void*)dbvec_ptr, pass_test);

//
//omit unnecessary
//

//Sealing part. Here, I seals the value pointed by &amp;amp;retval. (At least I think so)
size_t sealed_size = sizeof(sgx_sealed_data_t) + sizeof(retval);
    uint8_t* sealed_data = (uint8_t*)malloc(sealed_size);

    sgx_status_t ecall_status;
    status = seal(global_eid, &amp;amp;ecall_status,
            (uint8_t*)&amp;amp;retval, sizeof(retval),
            (sgx_sealed_data_t*)sealed_data, sealed_size);
&lt;/PRE&gt;

&lt;P&gt;But eventually I'd like to seal value which never exit from enclave. In other words, I think if I return that secret value from enclave to untrusted area like above code, it can be seen by untrusted area. How can I seal such secret values? Is there any ways to call sealing function from ECALL function?&lt;/P&gt;

&lt;P&gt;2. After unsealing, the decrypted data is on enclave? When I call the unsealing function like this(written on untrusted code)&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;int unsealed;
status = unseal(global_eid, &amp;amp;ecall_status,
            (sgx_sealed_data_t*)sealed_data, sealed_size,
            (uint8_t*)&amp;amp;unsealed, sizeof(unsealed));&lt;/PRE&gt;

&lt;P&gt;the decrypted data can be gain by referring to "&lt;SPAN style="font-family: Consolas, &amp;quot;Lucida Console&amp;quot;, Menlo, Monaco, &amp;quot;DejaVu Sans Mono&amp;quot;, monospace, sans-serif; font-size: 13.008px;"&gt;unsealed"&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;, but with this code, I think the decrypted value is on untrusted area. Is there any way to decrypt data on enclave and refer to that value from ECALL function?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Probably I'm writing very poor code and I still need to learn far more about SGX features, so any advice is welcome.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 13:22:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150622#M2555</guid>
      <dc:creator>aos</dc:creator>
      <dc:date>2017-11-02T13:22:54Z</dc:date>
    </item>
    <item>
      <title>Hi:</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150623#M2556</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;

&lt;P&gt;1.&amp;nbsp; You should provision the key though an secure way to the enclave.&lt;/P&gt;

&lt;P&gt;2.&amp;nbsp; If you don't want to expose your key, you can only use the key inside enclave. That means your encrypt implementation should inside enclave;&lt;/P&gt;

&lt;P&gt;3.&amp;nbsp; You can write three Ecall functions like this:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;//put key into enclave&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;provision_key&lt;/STRONG&gt;(key){&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sealed_key = sealed(key);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;//encrypt data with you key&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;encryp&lt;/STRONG&gt;t(data, sealed_key, encrypted)&lt;/P&gt;

&lt;P&gt;{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = unseal(sealed_key);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrpyted_data = encrppt(data, key);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;//decrypt encrypted_data with your key&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;decrypt&lt;/STRONG&gt;(encrypted_data, sealed_key, data)&lt;/P&gt;

&lt;P&gt;{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = unseal(sealed key);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = decrypt(encrypted_data, key);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;Hope you can understand,&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;you&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 08:27:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150623#M2556</guid>
      <dc:creator>you_w_</dc:creator>
      <dc:date>2017-11-03T08:27:25Z</dc:date>
    </item>
    <item>
      <title>I'd suggest looking at the</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150624#M2557</link>
      <description>&lt;P&gt;I'd suggest looking at the SealedData sample code included in the SGX SDK.&lt;/P&gt;

&lt;P&gt;It shows how to perform sealing/unsealing operations within an enclave applying difference policies.&lt;/P&gt;

&lt;P&gt;The Developer Reference describes what the sample code does.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 12:34:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150624#M2557</guid>
      <dc:creator>Juan_d_Intel</dc:creator>
      <dc:date>2017-11-03T12:34:28Z</dc:date>
    </item>
    <item>
      <title>Thank you for replying.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150625#M2558</link>
      <description>&lt;P&gt;Thank you for replying.&lt;/P&gt;

&lt;P&gt;I didn't notice that I can call another function in enclave from enclave function... Now maybe I can implement those secure sealing/unsealing features. Thanks for noticing me.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 15:03:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-can-I-seal-unseal-data-without-compromised-by-untrusted-area/m-p/1150625#M2558</guid>
      <dc:creator>aos</dc:creator>
      <dc:date>2017-11-06T15:03:02Z</dc:date>
    </item>
  </channel>
</rss>

