The Ceremony of the Keys is an ancient ceremony that takes place every night at the Tower of London. Just before 10pm, the Chief Warder secures the main gates of the Tower, then proceeds with the keys, escorted by four men of the guard, back into the fortress. On reaching the sentry point, the party is halted by the sentry and challenged to identify themselves. On being challenged, the Chief Warder identifies "Queen Elizabeth's Keys." The sentry then replies "Pass Queen Elizabeth's Keys, and all's well." Following this, the party makes its way into the fortress, where the guard presents arms, and the Chief Warder raises his hat, proclaiming "God preserve Queen Elizabeth". He then takes the keys in for safekeeping, while the Last Post is sounded.
Gibraltar
The Ceremony of the Keys in Gibraltar has its origins following the Great Siege of Gibraltar. In this ceremony, at the firing of the Sunset Gun, the Governor hands the keys of the fortress to the Port Sergeant. The Port Sergeant, accompanied by an armed escort, proceeds to lock the gates of the fortress for the night before returning them to the Governor. The party is also accompanied by drums and fifes, who sound a warning to aliens to leave the colony before the gates are closed.
Ceremonies known as the Ceremony of the Keys are held in at least three locations in the United Kingdom : London, Gibraltar, and Edinburgh.
The ceremony was reinstituted in 1933 and is currently performed twice a year (in April and October) by the Royal Gibraltar Regiment and resident British Battalions.
In the modern version of the ceremony, at the firing of the sunset gun, the Governor of Gibraltar symbolically hands the keys of the fortress to the Port Sergeant.