The countries jointly developed the sophisticated computer virus that collected critical intelligence in preparation for cyber sabotage attacks aimed at slowing Iran's ability to develop a nuclear weapon, according to Western officials with knowledge of the effort.