Registering and enrolling a Hyperledger Fabric identity turns a Fabric CA registration record into an MSP directory with a private key, signing certificate, and CA trust material. It is the normal handoff after a CA registrar approves a new application user, admin, peer, or orderer identity.
fabric-ca-client register runs with an enrolled registrar MSP and creates the enrollment ID, secret, type, affiliation, and optional attributes in the CA database. fabric-ca-client enroll runs as the target identity, generates the private key locally, sends the CSR to the CA, and stores the returned certificate chain under the selected MSP directory.
A client identity named appuser1 under org1.department1 keeps the workflow focused on application access. Replace the enrollment ID, affiliation, MSP paths, CA URL, and TLS root certificate with values from the organization, and deliver the enrollment secret out of band instead of leaving it in shared logs.
Steps to register and enroll a Hyperledger Fabric identity:
- Confirm the registrar MSP and CA connection details.
Registrar MSP: $HOME/fabric-ca/clients/admin/msp CA URL: https://ca.org1.example.com:7054 CA name: ca-org1 TLS root certificate: tls-root-cert/ca-org1.pem New identity: appuser1 Identity type: client Affiliation: org1.department1 Target MSP: $HOME/fabric-ca/clients/appuser1/msp
The registrar identity must already be enrolled and authorized to register the requested identity type and affiliation.
- Register the new identity with the CA.
$ FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin fabric-ca-client register \ --id.name appuser1 \ --id.secret appuser1pw \ --id.type client \ --id.affiliation org1.department1 \ --url https://ca.org1.example.com:7054 \ --caname ca-org1 \ --tls.certfiles tls-root-cert/ca-org1.pem Password: appuser1pw
The enrollment secret can appear in shell history, process listings, and transcripts. Add --id.maxenrollments 1 when the secret should enroll only once, and share it only with the identity owner.
- Check the stored identity record from the registrar MSP.
$ FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/admin fabric-ca-client identity list \ --id appuser1 \ --url https://ca.org1.example.com:7054 \ --caname ca-org1 \ --tls.certfiles tls-root-cert/ca-org1.pem Name: appuser1, Type: client, Affiliation: org1.department1, Max Enrollments: -1, Attributes: [{Name:hf.EnrollmentID Value:appuser1 ECert:true} {Name:hf.Type Value:client ECert:true} {Name:hf.Affiliation Value:org1.department1 ECert:true}]
The identity type and affiliation should match the role that the MSP will represent. Use peer or orderer only for node identities that will receive the matching node MSP and TLS material.
- Enroll the identity into its own MSP directory.
$ FABRIC_CA_CLIENT_HOME=$HOME/fabric-ca/clients/appuser1 fabric-ca-client enroll \ -u https://appuser1:appuser1pw@ca.org1.example.com:7054 \ --caname ca-org1 \ --tls.certfiles tls-root-cert/ca-org1.pem \ --mspdir msp 2026/06/21 11:18:24 [INFO] generating key: &{A:ecdsa S:256} 2026/06/21 11:18:24 [INFO] encoded CSR 2026/06/21 11:18:24 [INFO] Stored client certificate at /home/fabric/fabric-ca/clients/appuser1/msp/signcerts/cert.pem 2026/06/21 11:18:24 [INFO] Stored root CA certificate at /home/fabric/fabric-ca/clients/appuser1/msp/cacerts/ca-org1.pem
Add --csr.hosts when enrolling a peer, orderer, or TLS certificate that needs hostnames in the certificate. For a client identity, the default CSR normally only needs the enrollment ID as the common name.
Related: How to enable TLS for Hyperledger Fabric peer and orderer nodes - Check the generated MSP directories.
$ ls $HOME/fabric-ca/clients/appuser1/msp IssuerPublicKey IssuerRevocationPublicKey cacerts keystore signcerts user
keystore contains the private key, signcerts contains the enrollment certificate, and cacerts contains the CA certificate used to verify the issuer.
- Inspect the enrollment certificate subject.
$ openssl x509 -in $HOME/fabric-ca/clients/appuser1/msp/signcerts/cert.pem \ -noout -subject -issuer -serial subject=C=US, ST=North Carolina, O=Hyperledger, OU=org1 + OU=client + OU=department1, CN=appuser1 issuer=C=US, ST=North Carolina, O=Hyperledger, OU=Fabric, CN=fabric-ca-server serial=520DDA7772967A5C8C01DFD810A3426BB695D894
The subject should contain the enrollment ID and expected affiliation/type OUs. Keep the serial number for later renewal or revocation records.
Related: How to renew a Hyperledger Fabric certificate
Related: How to revoke a Hyperledger Fabric certificate - Restrict access to the MSP private key directory.
$ chmod -R go-rwx $HOME/fabric-ca/clients/appuser1/msp/keystore
Applications, peers, and orderers should read the MSP from a protected path owned by the account that runs the Fabric component.