Cognitive radio is considered as a pioneering technique in the domain of wireless communication as it enables and permits the Cognitive Users (CU) to exploit the unused channels of the Primary Users (PU) for communication and networking. The CU nodes access the vacant bands/channels through the Cognitive Radio Network (CRN) cycle by executing its different phases, which are comprised of sensing, decision making, sharing (accessing) and hand-off (mobility). Among these phases, hand-off is the most critical phase as the CU needs to switch its current data transmissions to another available channel by recalling all the previous functions upon the emergence of a PU. Further, from the security perspective, a Malicious User (MU) may imitate the PU signal with the intention to never allow the CU to use its idle band, which ultimately degrades the overall network performance. Attacks such as the Cognitive User Emulation Attack (CUEA) and Primary User Emulation Attack (PUEA) may be encountered by the handoff procedure, which need to be resolved. To address this issue, a secure and trusted routing and handoff mechanism is proposed specifically for the CRN environment, where malicious devices are identified at the lower layers, thus prohibiting them from being part of the communication network. Further, at the network layer, users need to secure their data that are transmitted through various intermediate nodes. To ensure a secure handoff and routing mechanism, a Trust Analyser (TA) is introduced between the CU nodes and network layer. The TA maintains the record of all the communicating nodes at the network layer while also computing the rating and trust value of the Handoff Cognitive User (HCUs) using the Social Impact Theory Optimizer (SITO). The simulation results suggest that the proposed solution leads to 88% efficiency in terms of better throughput of CRN during data communication, the packet loss ratio, the packet delivery ratio and the maximum and average authentication delay and clearly outperforms the prevailing mechanisms in all the parameters.