fabric-ca

https://www.jianshu.com/p/2f9af036a0af
register字面的意思是注册,注册就是主体向 CA 自我介绍的过程;enroll字面的意思是登记,就是最终实体进行证书申请并从 CA 接收证书的过程)

Key Usage:

tls: Digital Signature, Key Encipherment, Key Agreement
msp: Digital Signature
ca: Certificate Sign, CRL Sign

2. 证书OU

BCCSPKeyRequestGenerate

  echo "Enrolling the  CA admin" 
    docker exec ca.org$i.${dns}.com fabric-ca-client enroll -u https://org1:[email protected]$i.${dns}.com:805$i  --tls.certfiles /certs/root-ca/org$i/tls-cert.pem
    mkdir -p $PWD/certs/peerOrganizations/org$i.${dns}.com/msp
  
    echo "Registering the org admin"
    docker exec ca.org$i.${dns}.com fabric-ca-client register --id.name Admin --id.secret orgAdminpw --id.type admin --tls.certfiles /certs/root-ca/org$i/tls-cert.pem 
    --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*,role=admin:ecert"
    set -x
    echo "Enrolling the org admin"
    docker exec ca.org$i.${dns}.com fabric-ca-client enroll -u https://Admin:[email protected]$i.${dns}.com:805$i 
    -M /certs/peerOrganizations/org$i.${dns}.com/users/Admin@org$i.${dns}.com/msp --tls.certfiles /certs/root-ca/org$i/tls-cert.pem --csr.hosts peer$i.org$i.${dns}.com
    set -x
    cp ${PWD}/certs/peerOrganizations/org$i.${dns}.com/msp/config.yaml ${PWD}/certs/peerOrganizations/org$i.${dns}.com/users/Admin@org$i.${dns}.com/msp/config.yaml
    echo "Registering the org user"
    docker exec ca.org$i.${dns}.com fabric-ca-client register --id.name user1 --id.secret userpw  --id.type client  --tls.certfiles /certs/root-ca/org$i/tls-cert.pem  
    --id.attrs "hf.Registrar.Roles=client,hf.Registrar.Attributes=*"
    set -x
    echo "Enrolling the org user"
    docker exec ca.org$i.${dns}.com fabric-ca-client enroll -u https://user1:[email protected]$i.${dns}.com:805$i 
    -M /certs/peerOrganizations/org$i.${dns}.com/users/User1@org$i.${dns}.com/msp --tls.certfiles /certs/root-ca/org$i/tls-cert.pem --csr.hosts peer$i.org$i.${dns}.com


    生成证书所拥有的 OU为:
    org1          Subject: C=HK, ST=Hong Kong, L=Hong Kong, O=OGCIO, OU=client, CN=org1
    user Admin    Subject: C=HK, ST=Hong Kong, L=Hong Kong, O=OGCIO, OU=admin, CN=Admin
    user User1    Subject: C=HK, ST=Hong Kong, L=Hong Kong, O=OGCIO, OU=client, CN=user1

       echo "Registering the org peer$i"
       docker exec ca.org$j.${dns}.com fabric-ca-client register --id.name peer$i --id.secret peerpw --id.type peer --tls.certfiles /certs/root-ca/org$j/tls-cert.pem
       set -x
       echo "Generating the peer$i msp"
       docker exec ca.org$j.${dns}.com fabric-ca-client enroll -u https://peer$i:[email protected]$j.${dns}.com:805$j 
       -M /certs/peerOrganizations/org$j.${dns}.com/peers/peer$i.org$j.${dns}.com/msp --csr.hosts peer$i.org$j.${dns}.com   --tls.certfiles /certs/root-ca/org$j/tls-cert.pem
       set -x
       echo "Generating the peer$i tls"
       docker exec ca.org$j.${dns}.com fabric-ca-client enroll -u https://peer$i:[email protected]$j.${dns}.com:805$j 
       -M /certs/peerOrganizations/org$j.${dns}.com/peers/peer$i.org$j.${dns}.com/tls --csr.hosts peer$i.org$j.${dns}.com  --enrollment.profile tls 
       --tls.certfiles /certs/root-ca/org$j/tls-cert.pem

       生成证书所拥有的 OU为:
           Subject: C=HK, ST=Hong Kong, L=Hong Kong, O=OGCIO, OU=peer, CN=peer1

综上:OU为:--id.type 指定,CN为--id.name指定

你可能感兴趣的:(fabric-ca)