keygen.{h,c}: Read/write keys.