Walk alongside Sofia as you head up the hill into Masyaf fortress for the final time. For some reason, she seems to know the way to exactly where you need to go, including through the secret entrance leading to the library from the main hall, so just let Ezio auto-follow her if you’re not sure.
When you reach the door, it won’t be just as easy as inserting the keys. You’ll have to use your brain a little too! First, use Eagle Sense. Each of the keys corresponds to one of the vertices on the constellation to the right, as it’s the only one with enough space for all of the keys. Simply rotate them until they fit the shape. If you get stuck, there’s a hint button.
When you get it right, a short cutscene will play and Ezio will venture on alone. Approach the braziers on the wall to have Ezio light them, and proceed to the end of the passage where more surprising revelations await.