Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Latest commit

 

History

History
56 lines (39 loc) · 1.52 KB

README.md

File metadata and controls

56 lines (39 loc) · 1.52 KB

Yao's millionaires for MSE

This example allows to share integers and get the position of the maximum added interger. No one see the set of integers, only the position of the user who added the highest number is known.

Test locally

It's a good practice before deploying an app into MSE to test it locally:

$ mse cloud localtest
$ # push an integer
$ curl -X POST -H 'Content-Type: application/json' -d '{"n": 2.5}' http://127.0.0.1:5000/
$ # get the position of the user who added the maximum value
$ curl http://127.0.0.1:5000/

Deploy your application

$ mse cloud deploy  # in same folder as mse.toml

Your application is now ready to be used.

Test it

$ mse cloud test <APP_ID>

Use it

Get the SSL certificate (without checking the trustworthiness of the enclave):

$ # replace $APP_DOMAIN_NAME with your own app domaine name
$ openssl s_client -showcerts -connect $APP_DOMAIN_NAME:443 </dev/null 2>/dev/null | openssl x509 -outform PEM > cert.pem

check that it runs in an Intel SGX enclave (not checking code fingerprint):

$ mse cloud verify "$APP_DOMAIN_NAME"

then just query your trusted microservice:

$ # push an integer with your CA bundle
$ curl -X POST -H 'Content-Type: application/json' -d '{"n": 2.5}' https://$APP_DOMAIN_NAME/ --cacert cert.pem
$ # get the user with the max value with your CA bundle
$ curl https://$APP_DOMAIN_NAME/ --cacert cert.pem

See clients in various language if you don't want to use curl.