You may only walk over a white gate if you have collected a white key. For each time to pass a white gate, you need to collect a white key.