When the trio learns that Gringott’s might have a Dragon for security, they decide to pay Hagrid a visit.

“Yer wantin’ to get into the Lestrange vault, are ya? Here, gimme a second…” Hagrid rummages through one of his many pockets before pulling out a small golden key. “Here ya are, the Lestrange vault key. I reckon you’ll need this.”

The trio stare at the key in shock. “What- You- How on earth did you get that?” Hermione sputters.

Hagrid shrugged, “I’m the keeper o’ keys, it’s my job to hold onto a copy o’ everyone’s vault keys.” He turned to Harry, “I thought you knew. Didn’t ya ever wonder why I had the key to yer vault, when we went to Diagon all those years ago?”