Asylo
enclave_assertion_authority_configs.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 Asylo authors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef ASYLO_IDENTITY_ENCLAVE_ASSERTION_AUTHORITY_CONFIGS_H_
20 #define ASYLO_IDENTITY_ENCLAVE_ASSERTION_AUTHORITY_CONFIGS_H_
21 
22 #include <string>
23 #include <vector>
24 
25 #include "asylo/crypto/certificate.pb.h"
26 #include "asylo/identity/attestation/sgx/sgx_intel_ecdsa_qe_remote_assertion_authority_config.pb.h"
27 #include "asylo/identity/enclave_assertion_authority_config.pb.h"
28 #include "asylo/identity/identity_acl.pb.h"
29 #include "asylo/identity/platform/sgx/sgx_identity.pb.h"
30 #include "asylo/util/statusor.h"
31 
32 /// @file enclave_assertion_authority_configs.h
33 /// @brief Provides functions for creating enclave assertion authority configs.
34 ///
35 /// The term "enclave assertion authority" refers to the combination of
36 /// EnclaveAssertionGenerator and EnclaveAssertionVerifier for a particular type
37 /// of assertion.
38 ///
39 /// To configure assertion authorities in the untrusted application, use a
40 /// sequence of calls like the following:
41 ///
42 /// ```
43 /// std::vector<EnclaveAssertionAuthorityConfig> authority_configs = {
44 /// CreateNullAssertionAuthorityConfig(),
45 /// };
46 /// CHECK(InitializeEnclaveAssertionAuthorities(
47 /// authority_configs.cbegin(), authority_configs.cend()).ok());
48 /// ```
49 ///
50 /// To configure assertion authorities inside an enclave, pass the set of
51 /// configurations through the EnclaveConfig:
52 ///
53 /// ```
54 /// EnclaveManager *manager = ...
55 /// EnclaveLoadConfig load_config = ...
56 /// EnclaveConfig config;
57 /// *config.add_enclave_assertion_authority_configs() =
58 /// CreateNullAssertionAuthorityTestConfig();
59 /// *load_config.mutable_config() = config;
60 /// CHECK(manager->LoadEnclave(load_config).ok());
61 /// ```
62 ///
63 /// Assertion authorities are automatically initialized in TrustedApplication
64 /// using the provided configurations.
65 
66 namespace asylo {
67 
68 /// Creates a configuration for the null assertion authority.
69 ///
70 /// This configuration is required when using the NullAssertionGenerator or
71 /// NullAssertionVerifier.
72 ///
73 /// \return A config for the null assertion authority.
75 
76 /// Creates a configuration for the SGX local assertion authority.
77 ///
78 /// This configuration is required when using the SgxLocalAssertionGenerator or
79 /// SgxLocalAssertionVerifier.
80 ///
81 /// \param attestation_domain A 16-byte unique identifier for the SGX machine.
82 /// \return A config for the SGX local assertion authority.
85 
86 /// Creates a configuration for the SGX local assertion authority.
87 ///
88 /// The attestation domain is derived from the per-boot machine UUID in
89 /// /proc/sys/kernel/random/boot_id.
90 ///
91 /// This configuration is required when using the SgxLocalAssertionGenerator or
92 /// SgxLocalAssertionVerifier.
93 ///
94 /// /return A config for the SGX local assertion authority.
97 
98 /// Creates a configuration for the SGX AGE remote assertion authority.
99 ///
100 /// This configuration is required when using the
101 /// SgxAgeRemoteAssertionGenerator or SgxAgeRemoteAssertionVerifier.
102 ///
103 /// \param intel_cert The Intel root certificate to use for verification.
104 /// \param certificates A vector of X.509-formatted CA certificates that can
105 /// be used to verify whether an assertion is valid.
106 /// \param server_address The address of the AGE's service.
107 /// \param age_identity_expectation The identity expectation for the AGE.
108 /// \return A config for the SGX AGE remote assertion authority.
113 
114 /// Creates a configuration for the SGX AGE remote assertion authority.
115 ///
116 /// This configuration is required when using the
117 /// SgxAgeRemoteAssertionGenerator or SgxAgeRemoteAssertionVerifier. It uses the
118 /// Intel root certificate value |kIntelSgxRootCaCertificate| and no additional
119 /// root certificates. It sets the AGE identity expectation to the default
120 /// expectation of the given SgxIdentity, as documented by
121 /// `SgxIdentityMatchSpecOptions`.
122 ///
123 /// \param server_address The address of the AGE's service.
124 /// \param age_identity The expected identity of the AGE.
125 /// \return A config for the SGX AGE remote assertion authority.
129 
130 namespace experimental {
131 
132 /// Creates configuration for the SGX Intel ECDSA QE remote assertion authority.
133 /// The returned configuration contains the Intel SGX Root CA Certificate for
134 /// verifying assertion root of trust. Any generated assertions will include the
135 /// certification data that the Intel DCAP library locates using the Platform
136 /// Quote Provider Library, as documented in
137 /// https://download.01.org/intel-sgx/latest/dcap-latest/linux/docs/Intel_SGX_ECDSA_QuoteLibReference_DCAP_API.pdf
138 ///
139 /// This type of EnclaveAssertionAuthorityConfig is required when using the
140 /// SgxIntelEcdsaQeRemoteAssertionVerifier and/or
141 /// SgxIntelEcdsaQeRemoteAssertionGenerator.
142 ///
143 /// \return A config for the SGX Intel ECDSA QE remote assertion authority.
146 
147 /// Creates configuration for the SGX Intel ECDSA QE remote assertion authority.
148 /// The returned configuration contains the Intel SGX Root CA Certificate for
149 /// verifying assertion root of trust. Any generated assertions will include the
150 /// given `pck_certificate_chain` as certification data.
151 ///
152 /// This type of EnclaveAssertionAuthorityConfig is required when using the
153 /// SgxIntelEcdsaQeRemoteAssertionVerifier and/or
154 /// SgxIntelEcdsaQeRemoteAssertionGenerator.
155 ///
156 /// \param pck_certificate_chain The certification chain to include with any
157 /// generated assertions.
158 /// \param qe_identity The Intel ECDSA QE's identity.
159 /// \return A config for the SGX Intel ECDSA QE remote assertion authority.
163 
164 } // namespace experimental
165 
166 } // namespace asylo
167 
168 #endif // ASYLO_IDENTITY_ENCLAVE_ASSERTION_AUTHORITY_CONFIGS_H_
EnclaveAssertionAuthorityConfig CreateNullAssertionAuthorityConfig()
Creates a configuration for the null assertion authority.
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxIntelEcdsaQeRemoteAssertionAuthorityConfig(CertificateChain pck_certificate_chain, SgxIdentity qe_identity)
Creates configuration for the SGX Intel ECDSA QE remote assertion authority.
ABSL_CONST_INIT const char kStatusMoveAssignmentMsg[]
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxLocalAssertionAuthorityConfig()
Creates a configuration for the SGX local assertion authority.
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxAgeRemoteAssertionAuthorityConfig(Certificate intel_root_cert, std::vector< Certificate > certificates, std::string server_address, IdentityAclPredicate age_identity_expectation)
Creates a configuration for the SGX AGE remote assertion authority.
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxIntelEcdsaQeRemoteAssertionAuthorityConfig()
Creates configuration for the SGX Intel ECDSA QE remote assertion authority.
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxLocalAssertionAuthorityConfig(std::string attestation_domain)
Creates a configuration for the SGX local assertion authority.
StatusOr< EnclaveAssertionAuthorityConfig > CreateSgxAgeRemoteAssertionAuthorityConfig(std::string server_address, SgxIdentity age_identity)
Creates a configuration for the SGX AGE remote assertion authority.
Definition: aead_cryptor.h:155