Abstract:【Objective】With the rapid growth of various mobile applications and services, the contradiction between the battery capacity and the energy consumption at mobile terminals is becoming increasingly prominent. In addition, the ultra-dense deployment of small base stations (SBSs) in ultra-dense network (UDN) makes network interference more complicated, and servers deployed at the edge of the network are also vulnerable to malicious attacks.【Method】By jointly optimizing the user equipment (UE) association, cryptographic service assignment, UE power control, and computational resource allocation of UEs and SBSs, the sum of weighted standardized total energy consumption and standardized total security cost is minimized for the multi-task UDN. Specifically, mobile edge computing (MEC) and local computing models are first built for multi-task UDN. Then, a further improved hierarchical adaptive search (FIHAS) algorithm is designed for a problem with minimizing the sum of weighted normalized total energy consumption and normalized total safety cost. 【Result】In the simulation, FIHAS can obtain lower weighted sum than other algorithms and has an advantage in reducing total cost. 【Conclusion】In general, FIHAS may achieve the better system performance than other algorithms.