With the substantial increase in the amount of data information and the development of 5G technology, boundary computing technology based on 5G, as a real-time and efficient data processing method, has broad application prospects. The aggregation gateway further aggregates the power injection data of all electric energy storage units and sends it to the power company. The power company uses its own private key to access the aggregated data. Row decryption to obtain the total power data recovered in each time slot. The paper proposes a new solution using Lagrangian interpolation to ensure data privacy and security. The security shows that the algorithm can not only protect the privacy of the electric energy storage unit, but also realize the confidentiality and integrity of the injected data. Efficiency analysis shows that this algorithm can significantly reduce computational complexity and improve communication efficiency.