public static void ListAllCardholders() { Chilkat.Rest rest = new Chilkat.Rest(); bool success; // URL: https://api.stripe.com/v1/balance bool bTls = true; int port = 443; bool bAutoReconnect = true; success = rest.Connect("api.stripe.com", port, bTls, bAutoReconnect); if (success != true) { Log("ConnectFailReason: " + Convert.ToString(rest.ConnectFailReason)); Log(rest.LastErrorText); return; } Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder(); success = rest.FullRequestNoBodySb("GET", "/v1/issuing/cardholders", sbResponseBody); if (success != true) { Log(rest.LastErrorText); return; } Chilkat.JsonObject jsonResponse = new Chilkat.JsonObject(); jsonResponse.LoadSb(sbResponseBody); var o = jsonResponse.StringOf("object"); var livemode = jsonResponse.BoolOf("livemode"); }
public async Task Get_EndpointsReturnSuccessAndCorrectContentType(string url) { // Arrange AuthenticationManager authenticationManager = new AuthenticationManager(); authenticationManager.client = _factory.CreateClient(); File.WriteAllBytes("rsaCert.pfx", Startup.RsaCertPfxBytes); Chilkat.Pfx pfx = new Chilkat.Pfx(); if (File.Exists("rsaCert.pfx")) { pfx.LoadPfxFile("rsaCert.pfx", "12345"); } File.Delete("rsaCert.pfx"); // Act //public key from certificate //Chilkat package is used to process X509 certificate 2 from pfx file to JWKS (Json Web Key Set) from which it is possible //to extract public key X5c. Key is then compared with the one pulled from mocked server. string alias = "my_ecc_key1"; string password = "******"; Chilkat.JavaKeyStore jks = pfx.ToJavaKeyStore(alias, password); Chilkat.StringBuilder sbJwkSet = new Chilkat.StringBuilder(); jks.ToJwkSet(password, sbJwkSet); Chilkat.JsonObject jwkSet = new Chilkat.JsonObject(); jwkSet.LoadSb(sbJwkSet); jwkSet.EmitCompact = false; var jwksCheck = jwkSet.Emit(); JsonWebKeySet jwkscheck = new JsonWebKeySet(jwksCheck); List <JsonWebKey> keyList2 = new List <JsonWebKey>(jwkscheck.Keys); string publicKey2 = keyList2[0].X5c[0]; //response from server System.Net.Http.HttpResponseMessage response = await authenticationManager.client.GetAsync(url); //public key from endpoint string publicKey = authenticationManager.GetPublicKey(url); // Assert response.EnsureSuccessStatusCode(); // Status Code 200-299 Assert.Equal(publicKey2, publicKey); authenticationManager.client.Dispose(); _factory.Dispose(); }