Generating a public and private key pair