The basic meaning is "a key of eternity..." isn't it? Anyway, that's almost moot, because the way to say "X to Y" is by placing の after the "to" particle, but in the case of に の overrides it. You can do it with へ, but I think 。。。への鍵 isn't quite the meaning you want. By the way, I think 永遠(えいえん)would work better for "eternity," unless you mean it more like "eternal world."