We investigate the problem of optimizing the secrecy rate of a link between a single source and a single destination in the presence of multiple relays and multiple eavesdroppers. Multiple relays assist the source by either retransmitting a weighted version of the source signal in a decode-and-forward (DF) fashion, or by performing cooperative jamming (CJ) i.e., transmitting weighted noise in order to confound the eavesdropper. In each protocol, the relay weights are designed to maximize the secrecy rate subject to a total power constraint. For the case of a single eavesdropper we obtain expressions for the optimal weights under both protocols in closed form, or propose the algorithms to research for the solution. For the DF protocol with multiple eavesdroppers we propose an algorithm to search for the solution. Numerical results illustrate that cooperation can significantly improve the system performance as compared to direct transmission.