Localization and security are among the most dominant tasks of wireless sensor networks (WSN). For applications containing sensitive information on the location parameters of the event, secure localization is mandatory and must not be compromised at any cost. The main task, as if any node is malicious, is to authenticate nodes that are involved in the localization process. In this paper, we propose a secure hop-based algorithm that provides a better localization accuracy. In addition, to maintain the security of the localization process, the digital signature approach is used. Moreover, the impact of malicious nodes on the proposed scheme has also been observed. The proposed approach is also contrasted with the basic DV-Hop and improved DV-Hop based on error correction. From the simulation outcomes, we infer that this secure digital-signature-based localization strategy is quite robust against any node compromise attacks, thereby boosting its precision. Comparisons between the proposed algorithm and the state of the art were made on the grounds of different parameters such as the node quantity, ratio of anchor nodes, and range value towards the localization error.