moved connection-keygen code