Search in sources :

Example 6 with Enrollment

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

the class HFCAClientTest method testRevoke1Exception.

@Test
public void testRevoke1Exception() throws Exception {
    thrown.expect(RevocationException.class);
    thrown.expectMessage("Error while revoking cert");
    HFCAClient client = HFCAClient.createNewInstance("client", "http://localhost:99", null);
    client.setCryptoSuite(crypto);
    KeyPair keypair = crypto.keyGen();
    Enrollment enrollment = new HFCAEnrollment(keypair, "abc");
    client.revoke(admin, enrollment, "keyCompromise");
}
Also used : KeyPair(java.security.KeyPair) Enrollment(org.hyperledger.fabric.sdk.Enrollment) Test(org.junit.Test)

Example 7 with Enrollment

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

the class HFCAClientTest method testRevoke1NullUser.

// revoke1: revoke(User revoker, Enrollment enrollment, String reason)
@Test
public void testRevoke1NullUser() throws Exception {
    thrown.expect(InvalidArgumentException.class);
    thrown.expectMessage("revoker is not set");
    HFCAClient client = HFCAClient.createNewInstance("client", "http://localhost:99", null);
    client.setCryptoSuite(crypto);
    KeyPair keypair = crypto.keyGen();
    Enrollment enrollment = new HFCAEnrollment(keypair, "abc");
    client.revoke(null, enrollment, "keyCompromise");
}
Also used : KeyPair(java.security.KeyPair) Enrollment(org.hyperledger.fabric.sdk.Enrollment) Test(org.junit.Test)

Aggregations

Enrollment (org.hyperledger.fabric.sdk.Enrollment)7 Test (org.junit.Test)6 RegistrationRequest (org.hyperledger.fabric_ca.sdk.RegistrationRequest)5 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)4 SampleUser (org.hyperledger.fabric.sdkintegration.SampleUser)4 EnrollmentRequest (org.hyperledger.fabric_ca.sdk.EnrollmentRequest)4 Attribute (org.hyperledger.fabric_ca.sdk.Attribute)3 KeyPair (java.security.KeyPair)2 Properties (java.util.Properties)1 HFCAClient (org.hyperledger.fabric_ca.sdk.HFCAClient)1 HFCAInfo (org.hyperledger.fabric_ca.sdk.HFCAInfo)1