public void TestRevoke2NullUser() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; client.Revoke(null, admin.Name, "keyCompromise"); }
public UserManager() { keyStorePath = @"D:\Projetos\Hyperledger\fabcar\hfc-key-store\"; admin = SampleUser.Load("admin", keyStorePath); fabric_client = HFClient.Create(); var crypto = new Hyperledger.Fabric.SDK.Security.CryptoPrimitives(); crypto.Init(); crypto.Store.AddCertificate(admin.Enrollment.Cert); fabric_client.CryptoSuite = crypto; fabric_client.UserContext = admin; channel = fabric_client.NewChannel("mychannel"); var peer = fabric_client.NewPeer("p1", $"grpc://{Startup.HyperleaderServer}:7051"); channel.AddPeer(peer); var ordered = fabric_client.NewOrderer("o1", $"grpc://{Startup.HyperleaderServer}:7050"); channel.AddOrderer(ordered); channel.Initialize(); fabric_ca_client = new Hyperledger.Fabric_CA.SDK.HFCAClient("", $"http://{Startup.HyperleaderServer}:7054", new Hyperledger.Fabric.SDK.Helper.Properties()); fabric_ca_client.CryptoSuite = crypto; }
public void TestHFCAIdentityCryptoNull() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = null; client.NewHFCAIdentity("testid"); }
public void TestHFCAIdentityIDNull() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; client.NewHFCAAffiliation(null); }
public void TestReenrollNullUser() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; client.Reenroll(null); }
public void TestBadAffiliationNameEndingDot() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; client.NewHFCAAffiliation("foo."); }
public void TestIdemixNullEnrollment() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; client.IdemixEnroll(null, "idemixMSP"); }
public void TestHFCAIdentityCryptoNull() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = null; client.NewHFCAAffiliation("org1"); }
public void TestBadAffiliationNameMultipleDots() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; client.NewHFCAAffiliation("foo...bar"); }
public void TestNewInstanceWithName() { HFCAClient memberServices = HFCAClient.Create("name", "http://localhost:99", null); Assert.IsNotNull(memberServices); Assert.AreSame(typeof(HFCAClient), memberServices.GetType()); }
public void TestRevoke2NullEnrollment() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; client.Revoke(admin, (string)null, "keyCompromise"); }
public void TestNewInstanceWithNameAndProperties() { Properties testProps = new Properties(); HFCAClient memberServices = HFCAClient.Create("name", "http://localhost:99", testProps); Assert.IsNotNull(memberServices); Assert.AreSame(typeof(HFCAClient), memberServices.GetType()); }
public void TestReenrollNullEnrollment() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; admin.Enrollment = null; client.Reenroll(admin); }
public void TestIdemixWrongEnrollment() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; IEnrollment enrollment = new IdemixEnrollment(null, null, "mspid", null, null, null, "ou", IdemixRoles.MEMBER); client.IdemixEnroll(enrollment, "mspid"); }
public void GetAffiliationNoServerResponse() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCAAffiliation aff = client.NewHFCAAffiliation("neworg1"); aff.Read(admin); }
public void DeleteAffiliationNoServer() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCAAffiliation aff = client.NewHFCAAffiliation("neworg1"); aff.Delete(admin); }
public void TestSetCryptoSuite() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); CryptoPrimitives testcrypt = new CryptoPrimitives(); client.CryptoSuite = testcrypt; Assert.AreEqual(testcrypt, client.CryptoSuite); }
public void TestAddCAToURL() { string url = "http://localhost:99"; HFCAClient client = HFCAClient.Create("ca1", url, null); client.CryptoSuite = crypto; string url2 = client.AddCAToURL(url); Assert.AreEqual(url + "?ca=ca1", url2); }
public void DeleteIdentityNoServerResponse() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCAIdentity ident = client.NewHFCAIdentity("testuser1"); ident.Delete(admin); }
public void GetCertificateNoServerResponse() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCACertificateRequest certReq = client.NewHFCACertificateRequest(); client.GetHFCACertificates(admin, certReq); }
public void TestRegisterNullRegistrar() { RegistrationRequest regreq = new RegistrationRequest("name", "affiliation"); regreq.EnrollmentID = "abc"; HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; client.Register(regreq, null); }
public void TestRevoke1NullUser() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; KeyPair keypair = crypto.KeyGen(); IEnrollment enrollment = new X509Enrollment(keypair, "abc"); client.Revoke(null, enrollment, "keyCompromise"); }
public HFCAAffiliation(string name, HFCAClient client) { ValidateAffiliationNames(name); if (client.CryptoSuite == null) { throw new ArgumentException("Crypto primitives not set."); } Name = name; this.client = client; }
public void TestHFCACertificateNewInstance() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCACertificateRequest certReq = client.NewHFCACertificateRequest(); Assert.IsNotNull(certReq); Assert.AreEqual(typeof(HFCACertificateRequest).Name, certReq.GetType().Name); }
public void TestHFCAIdentityNewInstance() { HFCAClient client = HFCAClient.Create("http://localhost:99", null); client.CryptoSuite = crypto; HFCAAffiliation aff = client.NewHFCAAffiliation("org1"); Assert.IsNotNull(aff); Assert.AreSame(typeof(HFCAAffiliation), aff.GetType()); }
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"); }
public void TestEnrollmentNoServerResponse() { ICryptoSuite cryptoSuite = Factory.Instance.GetCryptoSuite(); EnrollmentRequest req = new EnrollmentRequest("profile 1", "label 1", null); HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = cryptoSuite; client.Enroll(TEST_ADMIN_NAME, TEST_ADMIN_NAME, req); }
public HFCAIdentity(string enrollmentID, HFCAClient client) { if (string.IsNullOrEmpty(enrollmentID)) { throw new ArgumentException("EnrollmentID cannot be null or empty"); } if (client.CryptoSuite == null) { throw new ArgumentException("Client's crypto primitives not set"); } EnrollmentId = enrollmentID; this.client = client; }
public void TestRegisterNoServerResponse() { Properties testProps = new Properties(); HFCAClient client = HFCAClient.Create("client", "https://localhost:99", testProps); CryptoPrimitives testcrypt = new CryptoPrimitives(); client.CryptoSuite = testcrypt; RegistrationRequest regreq = new RegistrationRequest("name", "affiliation"); client.Register(regreq, admin); }
public void TestIdemixMissingMSPID() { HFCAClient client = HFCAClient.Create("client", "http://localhost:99", null); client.CryptoSuite = crypto; var gen = new ECKeyPairGenerator(); var keyGenParam = new KeyGenerationParameters(new SecureRandom(), 256); gen.Init(keyGenParam); KeyPair pair = KeyPair.Create(gen.GenerateKeyPair()); IEnrollment enrollment = new X509Enrollment(pair, ""); client.IdemixEnroll(enrollment, null); }