Search in sources :

Example 6 with CryptoPrimitives

use of org.hyperledger.fabric.sdk.security.CryptoPrimitives in project fabric-sdk-java by hyperledger.

the class HFCAClientTest method testRegisterNoServerResponseAllHostNames.

@Test
public void testRegisterNoServerResponseAllHostNames() throws Exception {
    thrown.expect(RegistrationException.class);
    thrown.expectMessage("Error while registering the user");
    Properties testProps = new Properties();
    testProps.setProperty("allowAllHostNames", "true");
    HFCAClient client = HFCAClient.createNewInstance("client", "https://localhost:99", testProps);
    CryptoPrimitives testcrypt = new CryptoPrimitives();
    client.setCryptoSuite(testcrypt);
    RegistrationRequest regreq = new RegistrationRequest("name", "affiliation");
    client.register(regreq, admin);
}
Also used : Properties(java.util.Properties) CryptoPrimitives(org.hyperledger.fabric.sdk.security.CryptoPrimitives) Test(org.junit.Test)

Example 7 with CryptoPrimitives

use of org.hyperledger.fabric.sdk.security.CryptoPrimitives in project fabric-sdk-java by hyperledger.

the class HFCAClientTest method testRegisterNoServerResponseNoPemFile.

@Test
public void testRegisterNoServerResponseNoPemFile() throws Exception {
    thrown.expect(InvalidArgumentException.class);
    thrown.expectMessage("Unable to add CA certificate");
    Properties testProps = new Properties();
    testProps.setProperty("pemFile", "nofile.pem");
    HFCAClient client = HFCAClient.createNewInstance("client", "https://localhost:99", testProps);
    CryptoPrimitives testcrypt = new CryptoPrimitives();
    client.setCryptoSuite(testcrypt);
    RegistrationRequest regreq = new RegistrationRequest("name", "affiliation");
    client.register(regreq, admin);
}
Also used : Properties(java.util.Properties) CryptoPrimitives(org.hyperledger.fabric.sdk.security.CryptoPrimitives) Test(org.junit.Test)

Example 8 with CryptoPrimitives

use of org.hyperledger.fabric.sdk.security.CryptoPrimitives in project fabric-sdk-java by hyperledger.

the class HFCAClientTest method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() {
    try {
        crypto = new CryptoPrimitives();
        crypto.init();
    } catch (Exception e) {
        throw new RuntimeException("HFCAClientTest.setupBeforeClass failed!", e);
    }
}
Also used : InvalidArgumentException(org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException) MalformedURLException(java.net.MalformedURLException) RegistrationException(org.hyperledger.fabric_ca.sdk.exception.RegistrationException) CryptoException(org.hyperledger.fabric.sdk.exception.CryptoException) EnrollmentException(org.hyperledger.fabric_ca.sdk.exception.EnrollmentException) ExpectedException(org.junit.rules.ExpectedException) RevocationException(org.hyperledger.fabric_ca.sdk.exception.RevocationException) CryptoPrimitives(org.hyperledger.fabric.sdk.security.CryptoPrimitives) BeforeClass(org.junit.BeforeClass)

Example 9 with CryptoPrimitives

use of org.hyperledger.fabric.sdk.security.CryptoPrimitives in project fabric-sdk-java by hyperledger.

the class HFCAIdentityTest method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() {
    try {
        crypto = new CryptoPrimitives();
        crypto.init();
    } catch (Exception e) {
        throw new RuntimeException("HFCAIdentityTest.setupBeforeClass failed!", e);
    }
}
Also used : InvalidArgumentException(org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException) MalformedURLException(java.net.MalformedURLException) IdentityException(org.hyperledger.fabric_ca.sdk.exception.IdentityException) CryptoException(org.hyperledger.fabric.sdk.exception.CryptoException) EnrollmentException(org.hyperledger.fabric_ca.sdk.exception.EnrollmentException) ExpectedException(org.junit.rules.ExpectedException) CryptoPrimitives(org.hyperledger.fabric.sdk.security.CryptoPrimitives) BeforeClass(org.junit.BeforeClass)

Aggregations

CryptoPrimitives (org.hyperledger.fabric.sdk.security.CryptoPrimitives)9 MalformedURLException (java.net.MalformedURLException)4 CryptoException (org.hyperledger.fabric.sdk.exception.CryptoException)4 EnrollmentException (org.hyperledger.fabric_ca.sdk.exception.EnrollmentException)4 InvalidArgumentException (org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException)4 Test (org.junit.Test)4 Properties (java.util.Properties)3 BeforeClass (org.junit.BeforeClass)3 ExpectedException (org.junit.rules.ExpectedException)3 AffiliationException (org.hyperledger.fabric_ca.sdk.exception.AffiliationException)2 IdentityException (org.hyperledger.fabric_ca.sdk.exception.IdentityException)2 RegistrationException (org.hyperledger.fabric_ca.sdk.exception.RegistrationException)2 RevocationException (org.hyperledger.fabric_ca.sdk.exception.RevocationException)2 ByteString (com.google.protobuf.ByteString)1 File (java.io.File)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1