In this paper, collaborative use of relays to form a beamforming system with the aid of perfect channel state information (CSI) and to provide physical-layer security is investigated. In particular, a decode-and-forward- based relay beamforming design subject to total and individual relay power constraints is studied with the goal of maximizing the secrecy rate. The total power constraint leads to a closed-form solution. The design under individual relay power constraints is formulated as an optimization problem which is shown to be easily solved using two different approaches, namely semidefinite programming and second-order cone programming. Furthermore, a simplified and suboptimal technique which reduces the computation complexity under individual power constraints is presented.