helper functions to open/save keys