TORONTO - Research In Motion (TSX:RIM) has suffered a legal setback in its effort to buy Certicom Corp. (TSX:CIC) in a hostile takeover.

An Ontario judge has granted Certicom's request for an order preventing the maker of the BlackBerry, Curve and Pearl smartphones from pursuing its current bid.

But Justice Alexandra Hoy says RIM would be entitled to make a friendly offer for Certicom, which develops technology for preventing unauthorized use of data communications.

Last month, Waterloo, Ont.-based RIM, which has long been a customer of Certicom, made a $66 million offer for the Mississauga, Ont.-based data encryption firm.

Certicom's board said the offer price was too low and that RIM made its initial bid with the benefit of confidential information shared by the two companies under the terms of two agreements.

RIM argued the use of confidential information was permitted by those two non-disclosure agreements signed in 2007 and 2008.

But the judge disagreed.

"The use of the confidential information provided pursuant to the two non-disclosure agreements at issue ... to assess the desirability of a hostile takeover bid breached those agreements," Hoy wrote in her decision.

She said RIM "shall be enjoined from taking any steps to advance the hostile takeover bid," launched Dec. 10.

In granting Certicom's request for a permanent injunction, the judge wrote it's still possible for RIM or another company to make an takeover offer without using the confidential information.

RIM said in a statement late Monday that it was "disappointed" by Certicom's decision to take the matter to court.

"As a result of the court order, Certicom shareholders will not be able to accept the offer, and if another offer materializes for Certicom, RIM cannot, without Certicom's prior written consent, participate in an auction for Certicom," the company stated.

"RIM believes this could hinder the value maximization process undertaken by Certicom."

RIM also said it is reviewing the court decision and considering alternatives, "including a possible appeal."

Last last month RIM extended the expiry date on its offer to buy Certicom by 12 days, to Jan. 27, to allow the court more time to process Certicom's challenges to the proposed deal.