Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Intel SGX web applications in linux

Ziidev
New Contributor I
4,306 Views

I am new to Intel SGX platform and i am not coder, so please explain in lame words. I want to know how we can develop a web application using Intel Sgx. A basic code would also be helpful, like a hello world string posted over the website using SGX ocall. I basically want to know how to connect these two applications. Do we build library and then call them in web apps or there is a direct way to inject sgx code into web.

0 Kudos
1 Solution
JesusG_Intel
Moderator
4,022 Views

(I meant to post this in the forum)


Hello Ziidev, we found a workaround that will allow you to install the Intel SGX SDK.

 

  1. Rename the SGX SDK installer .exe to SGX_installer.zip. Change the extension from .exe to .zip.
  2. Extract the SGX SDK installer .zip
  3. Go to the directory: SGX SDK/installs
  4. Double click on the components you want to install:
    1. SGX_SDK_100.msi
    2. SEWizardVS20xx
    3. SEConfigureVS20xx

 

Sincerely,

Jesus G.

Intel Customer Support


View solution in original post

0 Kudos
21 Replies
JesusG_Intel
Moderator
3,911 Views

Hello Ziidev,,


We don't have sample code for your use case. However, this recent thread has the answer you are looking for:


https://community.intel.com/t5/Intel-Software-Guard-Extensions/is-it-possible-to-write-app-in-python-and-enclave-in-C/m-p/1370480#M5168


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Ziidev
New Contributor I
3,887 Views

Hi Jesus G,

I hope you are doing fine. Thank you for your kind response. I have seen this solution and tried to install Gramine but failed because I think i already have installed sgx sdk but not why could not install why it failed again and again.

I am running DUAL Boot. I am facing issues on both ends. On Ubuntu SGX SDK is running fine but Gramine is not working. On windows when i tried to install SDK, it looks like something is going to happen but nothing appears after that. I am unable to install sdk psw on windows.

My system specification is intel (r) core i5-7200u CPU 2.5 GHz 2.71 GHz

The major problem i am facing that i want to know how to call sgx application from a web application. Is there any way i can understand and start working on it. Hope to hear back from you soon.

Best Regards

ZiiDev

 

0 Kudos
JesusG_Intel
Moderator
3,870 Views

Hello Ziidev,


First, confirm that SGX is exposed and enabled in BIOS. If SGX is exposed in BIOS, it may be "Software Controlled" which means you must activate it by running the SGX Activation App in your OS.


After you confirm that SGX is enabled in BIOS, you can install the SGX driver and platform software on the OS.


After you install the PSW, you can install the SGX SDK and run the samples in the SDK to confirm that everything is installed correctly.


If all of the above are taken care of and you are still having problems with Gramine, you must go to them for support as this is a 3rd party product.


Sincerely,

Jesus G.

Intel Customer Support





0 Kudos
Ziidev
New Contributor I
3,859 Views

Hi@JesusG_Intel ,

Intel SGX is enabled in the BIOS but still did not get an update. But after installing manually, as you can see the figure, Device manager does not show Intel SGX. An when I try to install SDK, screen does not proceed further and the application does not launch. Is there any problem with my system or my installation way.

Best Regards

ZiiDev

0 Kudos
JesusG_Intel
Moderator
3,848 Views

Hello Ziidev,


I was able to reproduce your issue.


Do you have Visual Studio 2022 installed?


The installer crashed when I had Visual Studio 2022 installed. I uninstalled VS 2022, then ran the installer and it worked. The SGX SDK integrates with either VS 2017 or VS 2019.


If you have VS 2022 and cannot uninstall it, try installing the SDK on a different machine without VS 2022. The machine does NOT need SGX to install the SDK.


Sincerely,

Jesus G.

Intel Customer Support



0 Kudos
Ziidev
New Contributor I
3,839 Views

Hi Jessus G,

I had VS 2022 but it did not crash. BTW I uninstalled it and installed 2017.

Maybe the problem i am facing is because of the prerequisite which might not be installed perfectly. I only installed VS workload " Desktop development with C++". I dont know how install the remaining. If this the problem please guide how to install ederger8r, standard c library, c++ runtime and c11. 

 

Thank you for your kind response.  

 

Best Regards,

ZiiDev

0 Kudos
JesusG_Intel
Moderator
3,817 Views

Hello ZiiDev,


The SGX SDK can be installed without having Visual Studio. However, if you want all of the SGX components to integrate with Visual Studio, then you must have VS 2017 or 2019 installed prior to SGX SDK installation.


We are still investigating the crash issue. Please provide us:

  • OS version with build number (from System Information)
  • Visual Studio numerical versions and SKUs (pro/enterprise) that were installed when you tried to install the SGX SDK


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Ziidev
New Contributor I
3,795 Views

Hi Jessus G,

Windows Built number is: Version 10.0.19044 Build 19044

Ziidev_1-1651262148772.png

I first installed 2022 but as per your suggestion, I uninstalled it and then installed 2017. I downloaded VS 2022 professional few days ago, so I hope you can guess the version of it.

Ziidev_2-1651262347381.png

This is all I got from VS2022 right now

Ziidev_3-1651280911283.png

Thank you for your consideration.

Best Regards

ZiiDev

 

 

0 Kudos
JesusG_Intel
Moderator
3,760 Views

Hello Ziidev,


Thanks for the information.


Please also provide system events.


  1. Search for Event Viewer in the Windows 10 search bar
  2. Open Event Viewer
  3. On the left navigation pane, expand Windows Logs | Application
  4. On the right navigation page, select Find and search for SGX.
  5. Select any errors or warnings and send us a screenshot of the content.


Sincerely,

Jesus G.

Intel Customer Support



0 Kudos
Ziidev
New Contributor I
3,749 Views

Hi Jessus G,

Thank you so much for your reply. I was waiting for it, I think it was because of the holiday. But thank you so much for considering me.

Here is the error i get for PSW.

 

Ziidev_0-1651501481019.png

And here is the error for SDK.

Ziidev_1-1651501565357.png

If anything else you need, I am always available.

 

Best Regards

ZiiDev

0 Kudos
Ziidev
New Contributor I
3,749 Views

I forget to put the details of the error. Please check them as well

for SDK:

- <System>
  <Provider Name="Application Error" />
  <EventID Qualifiers="0">1000</EventID>
  <Version>0</Version>
  <Level>2</Level>
  <Task>100</Task>
  <Opcode>0</Opcode>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2022-04-28T05:53:10.1916728Z" />
  <EventRecordID>1346</EventRecordID>
  <Correlation />
  <Execution ProcessID="0" ThreadID="0" />
  <Channel>Application</Channel>
  <Computer>DESKTOP-GOH28J9</Computer>
  <Security />
  </System>
- <EventData>
  <Data>install.exe_Intel® Software Setup Assistant</Data>
  <Data>3.5.0.207</Data>
  <Data>60814af6</Data>
  <Data>ntdll.dll</Data>
  <Data>10.0.19041.1682</Data>
  <Data>9b46280a</Data>
  <Data>c0000374</Data>
  <Data>000e6cf3</Data>
  <Data>162c</Data>
  <Data>01d85ac43b3cd79a</Data>
  <Data>C:\Users\shozi\AppData\Local\Temp\SGXSDK\2022-04-27_22-53-03\install.exe</Data>
  <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
  <Data>396be653-78ac-4c30-9749-581fe081a7b4</Data>
  <Data />
  <Data />
  </EventData>
  </Event>
 
 
For PSW:
 
- <System>
  <Provider Name="Application Error" />
  <EventID Qualifiers="0">1000</EventID>
  <Version>0</Version>
  <Level>2</Level>
  <Task>100</Task>
  <Opcode>0</Opcode>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2022-04-29T01:59:35.0667858Z" />
  <EventRecordID>1590</EventRecordID>
  <Correlation />
  <Execution ProcessID="0" ThreadID="0" />
  <Channel>Application</Channel>
  <Computer>DESKTOP-GOH28J9</Computer>
  <Security />
  </System>
- <EventData>
  <Data>install.exe_Intel® Software Setup Assistant</Data>
  <Data>3.5.0.207</Data>
  <Data>60814af6</Data>
  <Data>Microsoft.VisualStudio.Setup.Configuration.Native.dll</Data>
  <Data>3.1.2200.53929</Data>
  <Data>6243c77f</Data>
  <Data>c00000fd</Data>
  <Data>000104d0</Data>
  <Data>23f0</Data>
  <Data>01d85b6cc45d80c0</Data>
  <Data>C:\Users\shozi\AppData\Local\Temp\sgxPSW\2022-04-29_06-59-29\install.exe</Data>
  <Data>C:\ProgramData\Microsoft\VisualStudio\Setup\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll</Data>
  <Data>c1cb21c1-2b61-41b5-a951-6656e0917a40</Data>
  <Data />
  <Data />
  </EventData>
  </Event>
 
Best Regards
ZiiDev
0 Kudos
JesusG_Intel
Moderator
4,023 Views

(I meant to post this in the forum)


Hello Ziidev, we found a workaround that will allow you to install the Intel SGX SDK.

 

  1. Rename the SGX SDK installer .exe to SGX_installer.zip. Change the extension from .exe to .zip.
  2. Extract the SGX SDK installer .zip
  3. Go to the directory: SGX SDK/installs
  4. Double click on the components you want to install:
    1. SGX_SDK_100.msi
    2. SEWizardVS20xx
    3. SEConfigureVS20xx

 

Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
JesusG_Intel
Moderator
3,664 Views

Hello Ziidev,


To install the PSW in Windows:


  1. Download the Intel SGX PSW for Windows v2.15.100.4.zip from: https://www.intel.com/content/www/us/en/download/683952/intel-software-guard-extensions-intel-sgx-driver-and-data-center-attestation-primitives-intel-sgx-dcap.html
  2. Expand the zip, open a command line, and navigate to: Intel SGX PSW for Windows v2.15.100.4\base\WindowsServer2019_Windows10\
  3. Execute: pnputil /add-driver sgx_base.inf /install
  4. Navigate to: Intel SGX PSW for Windows v2.15.100.4\PSW_INF_RS3_and_above
  5. Execute: pnputil /add-driver sgx_psw.inf /install


If this does not work, send the Event Viewer log as before.


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Ziidev
New Contributor I
3,611 Views

Hello Jessus_G,

Well I tried to execute these commands but they says these are already installed. So it did not created a new event log. I am sharing here the last log from SGX

Ziidev_0-1652212695135.png

 

Ziidev_1-1652212772857.png

 

0 Kudos
JesusG_Intel
Moderator
3,641 Views

Hello Ziidev,


Were you able to install the PSW in Windows following the instructions above?


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Ziidev
New Contributor I
3,626 Views

Hello Jessus_G,

Sorry for the late reply. Well, my system went into some hardware issues. I will try install it and inform you about it, just give me few days. I have not tried to install it yet.

Best Regards,

ZiiDev

0 Kudos
Ziidev
New Contributor I
3,580 Views

I tried to install it but this process could not help me. I have submitted the result in 4th last message including this one.

0 Kudos
JesusG_Intel
Moderator
3,533 Views

Hello Ziidev,


Please try this workaround:


1. Uninstall all Microsoft Visual Studio instances and Visual Studio Installer.


2. Check that C:\ProgramData\Microsoft\VisualStudio\Setup\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll does not exist anymore. If it was not removed with Microsoft Visual Studio for some reason, unregister the DLL using

REGSVR32 /U C:\ProgramData\Microsoft\VisualStudio\Setup\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll

command in Command Prompt as Administrator, and then rename the file to Backup_Microsoft.VisualStudio.Setup.Configuration.Native.dll so the Intel® Installer can't load it.


3. Install Visual Studio 2019.


4. Install the SGX SDK and PSW INFs as mentioned before.


Sincerely,

Jesus G.

Intel Customer Support




0 Kudos
JesusG_Intel
Moderator
3,475 Views

Hi Ziidev,


Did the workaround work for you?


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Ziidev
New Contributor I
3,469 Views

Hi Jeesus_G,

I tried to do the same thing 3 times, It did not work. However, Thank you for your help. Now, I am developing my application on ubuntu. SGX is working fine on that OS. Its alot easier to work on windows but I cant wait to more, I will try later.

There I faces the issue of communication between SGX and web application. I tried this solution but it did not for c++ application https://unix.stackexchange.com/questions/497146/create-a-custom-url-protocol-handler .  

https://stackoverflow.com/questions/72242523/how-do-we-call-c-application-from-web-on-client-side-on-linux , I uploaded my query there but did not get the good response. However in windows it was alot easier. I could have done it in seconds.

Anyhow, I appreciate your consideration. Thank you so much for your help. I will try to do these recommendations after installing a fresh window. May be next time it may work.

Best Regards

ZiiDev

0 Kudos
Reply