Reading the Enemy's Mail

""Gentlemen do not read each other's mail.""

- Secretary of State Henry L. Stimson upon closing down The Black Chamber, the U.S. government's peacetime cryptography section.

When fighting a war, cold or hot, you try to anticipate what the enemy is going to do. What, however, if you already knew what they were doing? What if you were able to decipher their messages and know their plans in advance?

This of course leads to problems -- what if they know you know? They'll change their codes. Therefore, you must be very careful- you can't, for example, just attack a ship because you know it's going somewhere- the other side might work out that the only way you would know is if you are...

Of course, stuff is still subject to interpretation.

Cipher machine theft is also a common plot in espionage, provided you are able to cover up said theft.

Film

 * In the 1983 film Enigma, Martin Sheen plays a CIA agent who must steal a Soviet scrambler from East Berlin. The CIA already have one- this is just a Batman Gambit to convince the Soviets they don't.
 * The main reason for wanting to attack the titular submarine in U-571 was to capture the submarine's enigma machine.

Literature
"What would be the point of ciphering messages that very clever enemies couldn't break? You'd end up not knowing what they thought you thought they were thinking."
 * In From Russia with Love (originally a novel), James Bond must collect a Soviet defector from Turkey, who is bringing a cipher machine with her. He has to start a fire in the embassy to cover up the theft.
 * In the Robert Harris novel Enigma, Bletchley Park has been locked out of "Shark", the German U-boat code. Part of the novel involves them getting back in, the other part making sure that the whole thing isn't blown to the Germans.
 * In the later part of the story, the heroes use an Enigma machine to decrypt a message that was stolen-.
 * In The Third World War, the US had cracked the Atrophos cipher being used by Cuba. In the early stages of the war, the Cubans send a long message stating that they cannot attack the US directly, but they might be able to do some small sabotage operations. While the Soviet cipher clerk is manually decrypting the message and wishing that the long-winded platitudes that begin it are done with, the Americans have broken the whole message. The Soviets interpret the message correctly (You cowards! You're wimping out like Italy in 1939), the Americans don't (They're going to attack us!) and launch air strikes on Cuba. It takes the rest of Latin America to stop a full-scale invasion.
 * In The Thrawn Trilogy, eventually the New Republic did figure out that Thrawn was aware of all the plans they made in the Imperial Palace on Coruscant. They spent a lot of effort going through the palace trying to find the listening devices, to no avail. Turns out Delta Source was right in front of them the whole time.
 * In Dan Brown's Digital Fortress, the NSA has a supercomputer capable cracking the digital encyrption keys used in e-mails. The titular program is touted as being unbreakable, prompting the NSA to
 * Discworld's Vetinari not only does this regularly in everyday life, but he expects others to do the same to him, and prepares accordingly. After all,


 * Most of Cryptonomicon (the 1940s bits, at least) is based around this. As with the real life section below, the Allies go to incredible amounts of effort to engineer plausible explanations for them having the information gained from intercepting enemy signals.
 * Stephen Maturin of the Aubrey-Maturin series does this frequently. He even carefully edits the messages before passing them along to spread misinformation in enemy lines. While his friend Jack Aubrey found the operation very dishonorable, Stephen once mentioned that he has no qualms about violating an entire mail coach if it wins them the war.
 * In the Tom Clancy novel The Sum of All Fears, a significant subplot involves whether or not NSA and State Department encoding methods have been cracked by the Soviets. In fact, they have, and at the end, when the US doesn't believe they've been cracked, it makes things in the climax significantly worse.
 * Clancy also likes looking into the specifics of certain cryptographic methods. Clear and Present Danger has a relatively long-winded passage on one-time pads (see below), and even The Hunt for Red October goes into some length about it.
 * Something Egwene and the other rebel Aes Sedai try to do while Dreaming with regards to Elaida's mail.

Comic Book

 * Y: The Last Man. In Paris, Alter is seen going through the mail to find the last "male".
 * V from V for Vendetta hacks Fate, the government's central supercomputer (and, incidentally, the love of the villain's life). He uses it to access both their surveillance systems and the freaking postal system in order to bring down the corrupt regime. Unlike the film, the postal system stuff was just to flip the bird at the establishment by showing them he was not only in their systems, but able to control them.

Real Life

 * ULTRA- namely the Allied decryption of the German Enigma and Lorenz ciphers for much of the war. Intensive efforts to provide "cover stories" were created- if you couldn't make it look like it had been found another way, you couldn't act on it.
 * There is some suggestion that the British lost Crete to keep ULTRA secret. London knew things about the German invasion plans, and they told the general commanding the defence of Crete what they knew. But they didn't dare tell him how they knew. So he didn't place full reliance on the intelligence, didn't commit fully to defending the airfields, and lost.
 * The bombing of Coventry during the Blitz is also believed to be a cover-up; ordering the city be evacuated would have revealed that the codes had been broken.
 * The Germans managed to crack the British merchant navy's codes in World War Two. The Kriegsmarine used this informtaion cautiously, leading Allied intelligence to think German sonar was far more advanced than it really was right up to the end of the war.
 * The Americans also cracked the Japanese ciphers in World War Two.
 * So the West couldn't do this, the Soviets used something called "one-time pads", where the coding method for each message was different. However, when one set got accidentally used twice, the West were able to figure out the messages and from 1946 break a good many of them. It was key to identifying a good number of Soviet moles, including the Rosenbergs and Julius Fuchs. Some people weren't prosecuted as VENONA (as it was called) was too valuable to be used in court- it was not declassified until 1995.
 * The one-time pad is, as long as the key is not compromised or re-used, completely uncrackable. A communications device was invented by the Norwegians after WWII based on this principle, but since each message requires pre-delivery of a key as long as the message itself, they deemed it completely useless. The machine was later picked up by US Intelligence, who used it as the basis of the Hot Line, since books with thousands of key codes could easily be exchanged by the embassies.
 * The Americans used a low-tech solution in World War II by using Navajo code-talkers, nicknamed wind-talkers, not to be confused with the fictional account in the movie Windtalkers. They didn't just speak in the Navajo language (which the Japanese were completely clueless to figure out anyway), but also spoke in code in the language. It was basically double encryption. The British apparently made similar use of Welsh.
 * During the English Civil War, John Thurloe became the Spymaster for the Commonwealth, and later the Protectorate. He also became Postmaster-General, which probably made his job quite a bit easier (It is worth mentioning that he did such a good job with governance that he was not even imprisoned after the Restoration in exchange for assisting with central government.
 * During the Irish War of Independence Michael Collins spy network was so sophisticated that top British Generals and Civil Servants mail arrived marked censored by the IRA.
 * The Zimmermann Telegram was a diplomatic note that was sent by the German Empire to Mexico, looking at seeing whether Mexico would be interested in declaring war on the United States should the increasingly pro-Triple-Entente US enter World War I. The Germans promised financial and military aid to help Mexico reclaim the "lost territories" of Arizona, New Mexico, and Texas. This telegram was intercepted by the British as it was passing through the US (direct communication lines from Germany to the Western Hemisphere were cut by the British, so the only way the Germans could communicate with their embassies in the Americas was via Canada and the US) and turned over to the Americans (Britain had to find other pieces of evidence so as to avoid admitting it was reading the US's diplomatic mail), thus further enraging American public opinion and leading to the US's entry into WW 1 on the side of the Entente. (Mexico, by the way, declined the offer.)
 * During the negotiations for the Washington Naval Treaties the US broke the Japanese diplomatic code which allowed them to know what Tokyo's instructions to its Ambassador was-and thus exactly how high the US had to bid. This had the unintended consequence in while the Japanese did not know what the US had done they did know it ended up with a larger fleet. Subverted in that the US and Japan were not enemies at the time though they did have various and sundry rivalries.
 * In the Antietam campaign a Union scout found Confederate plans wrapped around a pack of cigars.
 * In a clever but rather nasty exploitation of this, one British spymaster during World War I had a Turkish counterpart that was being unusually inconvenient. So to remove said inconvenience the British mailed a pack of gold and a letter thanking him for his good service and made sure the courier got captured. The Turks reacted accordingly.