如何将 Intel SGX Remote Attestation 应用于 encalve 在服务器中运行的模型?

How to apply Intel SGX Remote Attestation to the model that encalve runs in server?

Intel官方远程认证示例代码,如https://www.intel.com/content/www/us/en/developer/articles/code-sample/software-guard-extensions-remote-attestation-end-to-end-example.html,描述一个encalve运行在客户端,服务端提供秘密数据的模型,如下图所示。

Intel Remote Attestation Model

但是我想实现一个计算用户在 enclave 中的秘密数据的服务。所以有很多客户端提供秘密数据和一个服务器运行 encalve。 障碍是 intel sgx sdk 不适合这个模型。例如,在 sgx_tkey_exchange.h 中声明的函数 sgx_init_ra 接受一个 public 密钥供以后验证,英特尔的文档建议将 public 密钥硬编码到安全区代码中。

The Service Provider's public key should be hardcoded into the enclave. This, combined with enclave signing, ensures that the key cannot be changed by end users so that the enclave can only communicate with the intended remote service.

这适合英特尔的远程认证模型,但不适合我的。因为在我的模型中,有很多客户端(秘密数据提供者),并且很难安全地获取客户端的 public 密钥。

那么,请问这个机型有没有使用intel sgx sdk的方法?

英特尔当然建议您对 RA 服务器的 public 密钥进行硬编码,但这完全不是强制性的。

我正在从事一个实施飞地的研究项目,该飞地在开始时联系一个关键的 distribution/rotation 服务器。此服务器保存所有需要的 private/public/symmetric 密钥并以安全的方式分发它们。

如果您不想在您的 enclave 中对 RA 服务器的公钥进行硬编码,请使用您应用程序的不受信任部分联系将为您提供密钥的服务器。一种确保交易安全的方法是使用 MRSIGNER 作为 enclave 的身份。

总而言之,工作流程可能如下:

  • APP,不受信任:联系密钥服务器,获取 RA 服务器的公钥
  • APP,不受信任:创建 enclave,为其提供公钥
  • APP, TRUSTED: 完成认证过程
  • 等等。

但需要明确的是:请注意认证的目标是双重的。第一个是证明一个飞地,第二个(您可能感兴趣)是使用在 RA 的 DHKE 期间生成的会话密钥建立一个安全的通信通道。这是您在 RA 服务器和 enclave 之间交换信息的安全方式。