Deputy Attorney General Rod Rosenstein said "legislation may be necessary" if technology companies don't help the federal government access their data.

Speaking to the 10th annual Utah National Security and Anti-Terrorism Conference in Salt Lake City on Wednesday, the Department of Justice's No. 2 official noted that stored electronic information is "an effective and necessary law enforcement technique."

"Unfortunately, some companies are unwilling to help enforce court orders to obtain evidence of criminal activity stored in electronic devices," Rosenstein continued. "I hope that technology companies will work with us to stop criminals from defeating law enforcement. Otherwise, legislation may be necessary."

Rosenstein did not elaborate on what the "legislation" would entail.

Rosenstein mentioned the 2015 terrorist attack in San Bernardino, Calif., that left 14 people dead and another 22 more injured as an example of how "obtaining electronic data can be time-consuming, expensive and uncertain if technology providers refuse to cooperate."

The perpetrators of the attack were two homegrown extremists who were not directed by any foreign terror group to carry out the attack.

In February 2016, the FBI said it was unable to unlock the iPhone 5C that belonged to one of the shooters, Syed Rizwan Farook. When asked by the FBI to create a way to unlock the iPhone through backdoor encryption, Apple declined for fear it could create a bigger security problem for other users. The FBI then asked a judge to mandate Apple create new software to unlock the phone, and the Justice Department soon after urged the federal judge to compel the tech giant to do it.

However, the Justice Department announced in March it had found a way to unlock the iPhone and pulled its lawsuit.

This dilemma opened the door for questions on dealing with encryption — and it appeared changes would have to go through Congress.

Sens. Richard Burr, R-N.C., and Dianne Feinstein, D-Calif., unveiled legislation in April 2016 that would require technology companies to help the government access data — or face a fine.

However, the legislation went nowhere after backlash from technology organizations, advocacy and a bipartisan group of lawmakers. Then-President Barack Obama had also said he would not support the bill.

However, President Trump expressed his dismay at Apple's decision not to help the FBI.

"To think that Apple won't allow us to get into her cellphone? Who do they think they are?" Trump said in Fox News interview in early 2016 when he was the front-runner for the GOP nomination in the presidential race.

Earlier this year in February, James Baker, the FBI's general counsel said that the White House has talked about such encryption policy — but that no new policy was coming.

"It is a big topic and one that people have discussed," Baker said. "I am not aware of any policy change or even a determination at this point in time, given how soon we are into the new administration."

The White House did not immediately respond to a request for comment.