In 1917 during WWI, German Foreign Secretary Arthur Zimmermann sent an encrypted telegram to the German ambassador Heinrich von Eckardt, who was currently in Mexico.
Unfortunately for the Germans, British cryptographers got hold of the Zimmermann Telegram by eavesdropping on an American cable. Nigel Grey was able to decrypt some of the message in a day and spent the next three weeks with William Montgomery cracking the rest. Those weeks gave the British time to think of a way to present their discovery of the Telegram, mostly to the United States and Germany.
They couldn’t just tell the United States that they had been listening in on their cable, nor could they let the Germans know that they had broken their code. Lucky for the British, they had an agent in Mexico who bribed an employee from the telegraph company to give them the original message. Now they could show the message to the United States, but they still needed to take care of covering up their knowledge of the cypher. So, they claimed they stole the decrypted text in Mexico.The tables were then turned on Germany to find their nonexistent mole (they did not consider that their code could have possibly been broken).
The Telegram eventually made it to the press on 1 March 1917. A fair amount of reluctance prevented citizens and government officials from believing the message was real: no one wanted to be part of the war. But a few days later, Zimmerman confessed that the Telegram was real and gave a speech on 29 March 1917 to further its validity. The United States joined the war on 6 April 1917 while Mexico remained neutral.
Find more newspaper clippings regarding WWI in the Washington Post.