Fixed key length error in keygen routines.