def __init__(self, config): # Initialize the keys that can be used later to # register the enclave self._config = config enclave._SetLogger(logger) super(KeyManagementEnclaveInfo, self).__init__( enclave.is_sgx_simulator()) self._initialize_enclave(config) enclave_info = self._create_enclave_signup_data(config) try: self.ias_nonce = enclave_info['ias_nonce'] self.sealed_data = enclave_info['sealed_data'] self.verifying_key = enclave_info['verifying_key'] self.encryption_key = enclave_info['encryption_key'] self.encryption_key_signature = \ enclave_info['encryption_key_signature'] self.proof_data = enclave_info['proof_data'] self.enclave_id = enclave_info['enclave_id'] except KeyError as ke: raise Exception("missing enclave initialization parameter; {}" .format(str(ke))) self.enclave_keys = \ keys.EnclaveKeys(self.verifying_key, self.encryption_key)
def create_enclave_signup_data(self, ex_data): """ Create enclave signup data Parameters : @param ex_data - Ex_data containing the public verification key generated by KME Returns : @returns enclave_info - A dictionary of enclave data """ self._ext_data = ex_data ias_nonce = '{0:032X}'.format(random.getrandbits(128)) try: enclave_data = self._create_signup_info(ias_nonce, ex_data) except Exception as err: raise Exception( 'failed to create enclave signup data; {}'.format(err)) try: self.ias_nonce = ias_nonce self.verifying_key = enclave_data.verifying_key self.encryption_key = enclave_data.encryption_key self.encryption_key_signature = \ enclave_data.encryption_key_signature self.enclave_id = enclave_data.verifying_key self.proof_data = '' if not enclave.is_sgx_simulator(): self.proof_data = enclave_data.proof_data self.enclave_keys = \ keys.EnclaveKeys(self.verifying_key, self.encryption_key) # No sealed data is present for WPE self.sealed_data = None except AttributeError as attr: raise Exception( "missing enclave initialization parameter; {}".format( str(attr)))
def __init__(self, enclave_info, tcf_instance_keys): # Initialize the keys that can be used later to # register the enclave self.tcf_instance_keys = tcf_instance_keys try: self.nonce = enclave_info['nonce'] self.sealed_data = enclave_info['sealed_data'] self.verifying_key = enclave_info['verifying_key'] self.encryption_key = enclave_info['encryption_key'] self.proof_data = enclave_info['proof_data'] self.enclave_id = enclave_info['enclave_id'] except KeyError as ke: raise Exception( "missing enclave initialization parameter; {}".format(str(ke))) self.enclave_keys = \ keys.EnclaveKeys(self.verifying_key, self.encryption_key)