In this paper, the security attack status in wireless sensor network (WSN) is analysed, and integrated with the features of WSN, a safety trust evaluation mechanism is proposed for WSN. It evaluates the nodes by delivery behaviour of sensor nodes and considers the subjective evaluation with trust value recommendation of other nodes, to establish trust evaluation model which is easy to be implemented. It refers to indirect reputation parameters of neighbour nodes and integrates them to the energy reputation parameters, to achieve comprehensive evaluation value of nodes. The credibility is determined by the degree that is beyond or lower that the threshold. Simultaneously, we also take into account the link quality of links and put forward improved routing setting strategy. The simulation results indicate the model can reflect the credibility of nodes accurately and it can effectively protect malicious libel, which also improves the system security and reliability, to shoe the fairness of network.