def compute_pdo_add_enclave_signature(signing_key, verifying_key, contract_id, enclave_info_json_string): signer = keys.ServiceKeys(crypto.SIG_PrivateKey(signing_key)) message = verifying_key + contract_id message+= enclave_info_json_string return signer.sign(message, encoding='raw')
def compute_pdo_update_contract_state_signature(signing_key, verifying_key, contract_enclave_id, contract_enclave_signature, \ state_update_info_string): signer = keys.ServiceKeys(crypto.SIG_PrivateKey(signing_key)) message = crypto.string_to_byte_array(verifying_key + contract_enclave_id) message += contract_enclave_signature message += crypto.string_to_byte_array(state_update_info_string) return signer.sign(message, encoding='raw')
def compute_pdo_signature_contract_registration(signing_key, verifying_key, contract_code_hash, \ provisioning_service_ids_array, nonce): signer = keys.ServiceKeys(crypto.SIG_PrivateKey(signing_key)) message = crypto.string_to_byte_array(verifying_key) + contract_code_hash for s in provisioning_service_ids_array: message += crypto.string_to_byte_array(s) message += crypto.string_to_byte_array(nonce) return signer.sign(message, encoding='raw')
def compute_creator_initialize_state_signature(creator_signing_key, contract_enclave_signature): signer = keys.ServiceKeys(crypto.SIG_PrivateKey(creator_signing_key)) return signer.sign(contract_enclave_signature, encoding='raw')