gpg: Refactor keyedit module.