SAN FRANCISCO—BlackBerry Ltd. and Samsung Electronics Co. on Thursday agreed to sell each other’s mobile-security technology, a partnership that could help them win more enterprise customers.

The announcement came as BlackBerry US:BBRY unveiled its new mobile-security software—dubbed BlackBerry Enterprise Service 12, or BES12—a key part of its plan to double revenue from software sales to $500 million and return to profitability in its next fiscal year by winning back corporate and government business.