All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperledger.fabric.sdk.identity.X509Identity Maven / Gradle / Ivy

Go to download

Java SDK for Hyperledger Fabric. Deprecated as of Fabric v2.5, replaced by org.hyperledger.fabric:fabric-gateway.

There is a newer version: 2.2.26
Show newest version
package org.hyperledger.fabric.sdk.identity;

import org.hyperledger.fabric.protos.msp.Identities;
import org.hyperledger.fabric.sdk.User;
import org.hyperledger.fabric.sdk.transaction.ProtoUtils;

public class X509Identity implements Identity {

    protected final User user;

    public X509Identity(User user) {
        if (user == null) {
            throw new IllegalArgumentException("User is null");
        }
        if (user.getEnrollment() == null) {
            throw new IllegalArgumentException("user.getEnrollment() is null");
        }
        if (user.getEnrollment().getCert() == null) {
            throw new IllegalArgumentException("user.getEnrollment().getCert() is null");
        }

        this.user = user;
    }

    @Override
    public Identities.SerializedIdentity createSerializedIdentity() {
        return ProtoUtils.createSerializedIdentity(user);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy