utils: add keyfile read/write func