public static void CreateKey() { Global glob = new Global(); glob.UnlockBundle("Anything for 30-day trial"); SshKey key = new SshKey(); Rsa rsaKey = new Rsa(); rsaKey.GenerateKey(1024); _privateKey = rsaKey.ExportPrivateKeyObj(); Console.WriteLine("Private Key: " + rsaKey.ExportPrivateKey()); _publicKey = rsaKey.ExportPublicKey(); Console.WriteLine("Public Key: " + _publicKey); using (ConsulClient consulClient = new ConsulClient()) { String url = Constants.BASE_URL + ":" + Constants.CONSUL_PORT; Console.WriteLine("Consul URL: " + url); consulClient.Config.Address = new Uri(url); var putPair = new KVPair("publickey") { Value = Encoding.UTF8.GetBytes(_publicKey) }; var putAttempt = consulClient.KV.Put(putPair).Result; Console.WriteLine("Put Result: " + JsonConvert.SerializeObject(putAttempt)); } _isCreated = true; }