Upvote:8
Submarines weren't the only source of Enigma machines. The Poles had already worked on the code and the machine before WW2 began. Marian Rejewski cracked (a large part of) the code. The Poles gave the stuff they had to the Allies before the fall of Poland. In fact, the British didn't crack the Enigma code. The Poles did that.
The British raided the German weather ship Lauenburg in order to capture a working Enigma machine + codes. That raid was successful.
How did they keep it a secret? Place captives far away in Canada. It's not so easy for POW's to write 'be careful, they captured the Enigma'. Censorship comes in handy here.
A much bigger risk was that the Germans could easily guess their codes were broken, by looking at how effective the Royal Navy suddenly became.
The German 'Milch cow' submarines were prime targets. The Royal Navy couldn't (and didn't) sink all off them immediately upon receiving the positions, that would give the game away. Some were 'not found' or missed on purpose, in order to keep the secret secret. They were all hunted down eventually, but some could have been sunk a lot earlier.
Convoys could be diverted, but not too much and not too often. Many convoys were directed to make slight course changes that brought them just out of range. Not too much, otherwise the Germans would guess something was wrong.
Likewise, in the Mediterranean explicit orders were given not to act on Enigma information alone. When a ship or a convoy was expected because of an Enigma message, an airplane or ship was send in 'to discover' it first. Only after that discovery a real attack was allowed.
The Germans were almost as far with cracking the British codes as the British with the German codes.
Funny story after the war: When British colonies gained their independence, the former colonizers, good sports as they were, handed the new governments Enigma machines with manuals for free. They told them that was the famous Enigma machine, but they weren't able to crack it. As they had no use for them, they happily donated those machines to the new governments. Many new nations used them until well in the 60's. That way the British could read each and every message they send.
Upvote:19
The boarding party led by David Balme approaches U-110. Source: World War II Today
With regards to keeping the capture of the Enigma and codebooks from U-110 a secret (i.e. keeping the German POWs from revealing this to anyone), the German POWs did not know the U-110 was successfully boarded:
A number of schemes had been devised to capture these [internal Enigma rotors] but the boarding of U-110 came as an unexpected bonus. The U-boat had been forced to surface after depth charging, the crew had abandoned ship believing that the U-boat was already sinking. The surviving crew were rescued and quickly taken below decks so that they would not be aware that the boat was to be boarded. The commander of the boat Lemp died, possibly shot as he attempted to swim back to the boat to sink her. [emphasis added]
Source: World War II Today - 9th May 1941: Enigma Machine Captured
Upon recognizing the significance of what had been recovered, additional measures were taken by the British to keep this prize a guarded secret, to reap the most benefit from it:
The boarding party commanded by Lt David Balme made several journeys between U-110 and HMS Bulldog to collect whatever they could get their hands on inside the boat. This proved to be very fruitful, as U-110 was abandoned in a hurry, and being a Type IXB U-boat, did not sink as rapidly as a Type VIIC would have. It is almost certain that many U-boats were sunk as a result of the material found inside U-110, including an Enigma machine with rotors set and current code books.
The day after the capture, the British Admiralty realised the importance of this, and that if the Germans knew the boat had been captured, they would assume the worst and change their codes and cipher system. The boat was accordingly ordered to be scuttled while being towed to Britain, the surviving crew were taken straight to Iceland to be interned, and everyone involved in the capture sworn to secrecy. 15 of U-110's crew died in the action and 32 were interned. [emphasis and informational links added]
Source: Uboats.net