According to four former top federal government officials in intelligence and national security, it would not be a federal crime if Trump were to reveal the identity of the whistleblower.
“If Trump thinks he knows the name, he can come out and say it, and he’s probably as protected as anyone is,” said Robert Litt, former general counsel for the Office of the Director of National Intelligence under President Barack Obama.
Litt and several other legal experts who talked to NPR said Trump uttering or tweeting the name could in theory trigger an article of impeachment for retaliating against a whistleblower, but it would not run afoul of any federal criminal statutes.
If a news outlet, member of Congress or of the public were to out the whistleblower, no federal crime would be committed, but that doesn’t mean there would not be repercussions from such an act. A member of Congress could be removed from committees or face other sanctions, and a public citizen could face liability if the disclosure caused harm to the whistleblower or his/her family.
Workplace retaliation against the whistleblower following disclosure would constitute a federal crime. But the act of unmasking itself is not unlawful, unless the person is a covert agent.
See NPR. for more.