LONDON — Lady Trumpington, who worked on the top-secret Bletchley Park code-breaking operation during World War II and later embarked on a political career that made her a celebrity in Britain in her 90s, died on Monday. She was 96.

Her death was confirmed on Twitter by her son, Adam Barker. He did not say where she died.

Lady Trumpington — as Jean Alys Campbell-Harris — worked as a cipher clerk, typing intercepted messages from the German Navy, at Bletchley Park, the wartime British decoding facility where Alan Turing helped crack Germany’s Enigma code.

Bletchley Park’s achievements, kept secret for decades after the war, were made widely known by the films “Enigma” (2001) and “The Imitation Game” (2014), and, in 2017, by the posthumous pardon of Mr. Turing, who had been prosecuted after the war for homosexuality.

Lady Trumpington was appointed to the House of Lords, the upper chamber of the British Parliament, in 1980. She held a series of government positions from 1985 to 1997, leaving her last ministerial post at age 75.