The elastic properties and electronic structure of PtN2 with the pyrite structure (PtN2(C2)) were studied with first-principles calculations. The crystal structure is demonstrated to be elastically stable with a lower energy than the metastable fluorite structure proposed before. The calculated shear modulus of 214 GPa suggests that PtN2(C2) is harder than some well known hard materials such as TiN and SiC. The high elastic moduli are attributed to a stacking of corner-shared PtN6 octahedra bonded by strong N-N covalent bonding. In contrast to the metallic fluorite-type phase, PtN2(C2) is semiconducting with an indirect band gap.