The irony of the former CIA director getting caught in a sex scandal even though he was presumably the country's top spymaster is obvious.

But that doesn't mean that David Petraeus and his biographer-turned-mistress Paula Broadwell didn't use some handy espionage tradecrafts to keep their liaisons a secret for nearly a year.

Petraeus and Broadwell would communicate using a dummy Gmail account that they set up as a modern version of the classic spy 'dead drop' trick, where they would leave their messages in the account's draft folder to save it for the other to see.

Affair: David Petraeus is pictured with Paula Broadwell, his biographer and former mistress

Insult: A photograph in June 2011 shows
Broadwell watching as Petraeus and his wife Holly arrive for a Senate
Select Intelligence Committee hearing on Petraeus' nomination to be
director of the CIA

Rather than sending each other actual
emails, which would create an electronic paper trail, they would write
messages and save them as drafts.

The other would then log in to the same account, view the message, delete it and then leave a response that would also be saved rather than sent.

Dead drops, wherein spies leave messages for their sources or informants at a neutral location and then the individual would go and pick up the message before returning with their own response.

In the digital era, however, Gmail's draft folder creates an easy space for teenagers, terrorists, and apparently philandering politicians to do the same.

Deception: Paula Broadwell is married to a
radiologist, Scott Broadwell (left), and they have two young sons
together, while Petraeus has been married to Holly for 38 years. They
have two grown children

Petraeus was the one to set up the fake account in this case, and he used a pseudonym to do so.

The pair may never have been caught if Broadwell didn't go against the papertrail the save-but-don't-send trick safeguarded the lovers from.

The scandal came under investigation only after Broadwell used one of her email accounts to send anonymous emails to Florida housewife Jill Kelley.

Jealous: Broadwell sent Jill Kelley, far right, threatening emails warning her to stay away from Petraeus. Pictured with Kelley is her husband, Scott, and Holly Petraeus

The 37-year-old Kelley knows a number of high-profile military men because she is an honorary social liaison for MacDill Air Force base in Tampa, Florida.

Kelley contacted a friend of hers who is an FBI agent because she felt threatened and feared for her safety after receiving a half-dozen anonymous emails.

A government official told the New York Post that the emails contained such language as: 'I know what you did,' 'back off' and 'stay away from my guy.'

The official added: '(Broadwell) clearly thought something was going on' and thought she was in a 'lovers triangle.'

A person who knows both Mrs Kelley and Petraeus confirmed their friendship and said she saw him often.

'Very sexy': Kelley has been accused of sending 'flirtatious' messages to another general, John Allen

Enjoying herself? Kelley laughs while checking her phone in her Tampa home on Tuesday

All three of those involved- Kelley, Petraeus and Broadwell- were all married to other people and they all have multiple children.

The Kelleys- Jill and her surgeon husband Scott- have been close family friends with David and Holly Petraeus for around five years and the two couples have been frequently photographed together at parties.

Government sources have said that Kelley exchanged emails and IMs with General Petraeus daily but those were on his official account and were monitored by staff members, and are not considered inappropriate.

Now another four-star General has been roped into the allegations, as the Pentagon has since started its own investigation into 20,000 to 30,000 pages of communications between John Allen, the commander of U.S. and Nato forces in Afghanistan, and Kelley.

Scandal: Gen. John Allen, pictured before the Senate Armed Services Committee in March as his wife and daughter look on, is under investigation for sending 'inappropriate emails' to a military party planner

Allen and Mrs Kelley met in the same manner that she became close with Petraeus, as Allen served on the same Florida base from 2008 to 2011.

The same innocent nature of the communications between Kelley and Petraeus cannot be said about her emails with Allen, as investigators flagged a number of them for being ‘flirtatious’. They have not specified whether it was done by Kelley, Allen or both.

The Washington Post gave the example of Allen's use of the word 'sweetheart' in referring to married mom Kelley, but a senior Pentagon official said that proves nothing as the 58-year-old general is from Virginia and the word is used in the south as a platonic phrase and not one demonstrating a romantic relationship.