Example #1
0
        public void Remover(string userId)
        {
            try
            {
                var list = fabric_ca_client.GetHFCAIdentities(admin);

                var user = list.FirstOrDefault(x => x.EnrollmentId == userId);
                if (user != null)
                {
                    var test = fabric_ca_client.NewHFCAIdentity(userId);
                    var resp = test.Delete(admin);
                    if (resp == 1)
                    {
                        if (File.Exists(Path.Combine(keyStorePath, userId)))
                        {
                            var file = SampleUser.Load(userId, keyStorePath);
                            File.Delete(Path.Combine(keyStorePath, userId));
                            File.Delete(Path.Combine(keyStorePath, ((Enrollment)file.Enrollment).signingIdentity));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #2
0
        public void TestHFCAIdentityCryptoNull()
        {
            HFCAClient client = HFCAClient.Create("http://localhost:99", null);

            client.CryptoSuite = null;
            client.NewHFCAIdentity("testid");
        }
Example #3
0
        public void DeleteIdentityNoServerResponse()
        {
            HFCAClient client = HFCAClient.Create("http://localhost:99", null);

            client.CryptoSuite = crypto;

            HFCAIdentity ident = client.NewHFCAIdentity("testuser1");

            ident.Delete(admin);
        }
Example #4
0
        public void TestHFCAIdentityNewInstance()
        {
            HFCAClient client = HFCAClient.Create("http://localhost:99", null);

            client.CryptoSuite = crypto;
            HFCAIdentity ident = client.NewHFCAIdentity("testid");

            Assert.IsNotNull(ident);
            Assert.AreSame(typeof(HFCAIdentity), ident.GetType());
            Assert.AreEqual(ident.EnrollmentId, "testid");
        }
Example #5
0
        public void TestHFCAIdentityIDNull()
        {
            HFCAClient client = HFCAClient.Create("http://localhost:99", null);

            client.NewHFCAIdentity(null);
        }