Objectives: To design and develop pairwise key generation techniques for malicious node detection in wireless sensor network. Method: The lightweight key generation method has been used for data encryption with the collaboration of the sender node, entry node and destination. The unique identity of the destination server has utilized for data encryption and decryption as a master key. The proposed method generates a concise key length that reduces encryption and decryption time. It also helps to detect the misbehaviour of internal nodes when it takes higher time for data decryption and transmission. Findings: The proposed system reduces end to end delay around 10%, the packet delivery ratio improves by 3.30%, throughput by 9.87, and energy consumption by 20.50% than Advanced Encryption Standard and Rivest Shamir Adleman algorithm. The proposed encryption algorithm compresses the cypher data, reducing the network overhead, and detecting malicious nodes, providing higher security from internal and external intruders. This simulation obtains better results than existing systems that enhance around 7-9% throughput with all QoS parameters. Novelty: The proposed system eliminates network overhead of key transmission to the destination. Using this approach, the sender node generates a lightweight key for data encryption using the destination node, which means only the destination node can decrypt the data using the generation of similar keys. When any random node tries to generate such keys, it violates time-bound, and system detects as a malicious node.