네트워크에 타사 인증서가 있는 조직 추가

이 항목에는 타사 인증서를 사용하는 조직을 Oracle Blockchain Platform 네트워크에 연결하는 방법에 대한 정보가 포함되어 있습니다.

Oracle Blockchain Platform 네트워크에 타사 인증서가 있는 조직에 참가하는 일반적인 워크플로우

타사 CA(인증 기관)에서 발행한 인증서가 있는 조직은 Oracle Blockchain Platform 네트워크에 참가자로 참가할 수 있습니다.

클라이언트 전용 조직

이 참가자는 클라이언트 전용 조직이며 동료 또는 주문자가 없습니다. 채널 생성, 피어 조인 또는 체인코드 설치는 불가능합니다.

네트워크에 가입한 후 이러한 조직은 SDK 또는 Hyperledger Fabric CLI를 사용하여 다음을 수행할 수 있습니다.
  • 클라이언트 조직 관리자인 경우 체인 코드를 배포, 호출 및 쿼리합니다.
  • 클라이언트 조직 비관리자인 경우 체인코드를 호출하고 질의하십시오.
클라이언트 전용 조직이 네트워크에 속할 때 체인코드를 배포 및 호출할 수 있는 사용자를 제어하려면 다음을 수행합니다.
  • 체인코드를 피어에 설치하는 체인코드 소유자는 Hyperledger Fabric peer chaincode package -i 인스턴스화 정책 명령을 사용하여 체인코드에 대한 인스턴스화 정책을 설정함으로써 체인코드를 배포할 수 있는 사용자를 결정할 수 있습니다.
  • 체인코드 인스턴스 생성자는 Hyperledger Fabric peer chaincode instantiate -P 보증 정책 명령을 사용하여 체인코드를 호출할 수 있는 사용자를 제어하는 보증 정책을 설정할 수 있습니다.
  • 채널 소유자는 채널 제안 및 질의 액세스 제어 목록을 설정하여 체인코드를 호출하거나 질의할 수 있는 사용자를 결정할 수 있습니다. Hyperledger Fabric 액세스 제어 목록을 참조하십시오.

워크플로우

다음은 타사 인증서가 있는 조직과 Oracle Blockchain Platform 설립자가 Oracle Blockchain Platform 네트워크에 가입하기 위해 수행해야 하는 작업입니다.

태스크 누가 이 작업을 수행합니까? 설명 추가 정보
타사 인증서 가져오기 타사 인증서(참가자) 조직 타사 CA 서버로 이동하여 필요한 인증서 파일을 생성합니다. 필요에 따라 네트워크로 가져올 파일을 포맷합니다. 타사 인증서 요구사항
가져올 인증서 파일 만들기 타사 인증서(참가자) 조직 참가자의 관리 및 CA 인증서 정보를 찾아 JSON 인증서 파일을 작성하는 데 사용합니다. 조직의 타사 인증서 파일 만들기
제3자(참가자) 조직에 대한 인증서 파일 업로드 설립자 조직 콘솔을 사용하여 참가자의 인증서 파일을 업로드하고 가져와서 네트워크에 참가자를 추가합니다. 네트워크에 조직을 추가할 인증서 임포트
네트워크 설립자로부터 주문 서비스 설정을 내보내고 타사(참가자) 조직에 제공합니다. 설립자 조직 설립자의 주문 서비스 설정을 JSON 파일로 출력하고 참가자에게 파일을 보냅니다.

주문 서비스 설정 파일을 열고 주문 서비스의 주소와 포트를 찾아 참가자에게 제공합니다. 예:

"orderingServiceNodes": [
{
"address": "grpcs://example_address:7777"
...
}]
참가자 또는 스케일 아웃된 OSN에 가입하여 설립자 주문 서비스 제공
채널 생성 설립자 새 채널을 생성하고 참여자를 추가합니다. 채널 생성
체인코드 설치 및 배포 설립자 설립자의 인스턴스에서 체인코드를 업로드, 설치 및 배포합니다. 체인코드를 설치할 네트워크 피어를 선택합니다.
제3자(참가자) 조직의 환경 설정 타사 인증서(참가자) 조직 체인 코드를 query하거나 호출하려면 참가자는 다음을 수행해야 합니다.
  • 설립자의 주문 서비스 주소와 포트를 참가자 환경에 추가합니다.
  • Hyperledger Fabric CLI 또는 SDK를 사용하도록 환경을 구성합니다.
  • 피어에 체인 코드를 설치합니다.
Oracle Blockchain Platform Network를 사용할 타사 환경 준비

타사 인증서 요구사항

네트워크에 성공적으로 연결하려면 조직에서 필요한 타사 인증서를 생성해야 합니다. 이러한 인증서의 정보는 조직의 인증서 파일을 만드는 데 사용됩니다. 이 파일은 설립자의 인스턴스로 가져옵니다.

조직이 제공해야 하는 인증서는 무엇입니까?

CA 서버에서 다음 인증서를 생성해야 합니다.

  • 클라이언트 공용 인증서
  • CA 루트 인증서

해당 인증서에 대한 요구사항은 무엇입니까?

인증서는 다음 요구 사항을 충족해야 합니다.

  • 개인 키를 생성할 때는 타원 곡선 디지털 서명 알고리즘(ECDSA)을 사용해야 합니다. 이 알고리즘은 Fabric MSP 키에 대해 유일하게 허용되는 알고리즘입니다.
  • SKI(주제 키 식별자)는 필수이며 확장 파일에서 x509 확장자로 지정해야 합니다.
  • 키 파일을 .key에서 .pem 형식으로 변환해야 합니다.
  • 인증서를 .crt에서 .pem 형식으로 변환해야 합니다.

인증서 만들기

다음 안내서는 OpenSSL 또는 Hyperledger Fabric cryptogen 유틸리티를 사용하여 인증서를 생성하는 방법의 예입니다. 사용된 명령에 대한 자세한 내용은 다음을 참조하십시오.

OpenSSL를 사용하여 인증서를 만들려면 다음을 수행합니다.

  1. 자체 서명된 CA 인증서/키를 만듭니다.
    openssl ecparam -name prime256v1 -genkey -out ca.key
    openssl pkcs8 -topk8 -inform PEM -in ca.key -outform pem -nocrypt -out ca-key.pem
    openssl req -new -key ca-key.pem -out ca.csr
    openssl x509 -req -days 365 -in ca.csr -signkey ca-key.pem -out ca.crt -extensions x509_ext -extfile opensslca.conf
    openssl x509 -in ca.crt -out ca.pem -outform PEM
    예제 opensslca.conf 파일:
    [ req ]
    default_bits        = 2048
    distinguished_name  = subject
    req_extensions      = req_ext
    x509_extensions     = x509_ext
    string_mask         = utf8only
     
     
    [ subject ]
    countryName         = CN
    #countryName_default     = US
     
     
    stateOrProvinceName     = Beijing
    #stateOrProvinceName_default = NY
     
    localityName            = Beijing
    #localityName_default        = New York
     
    organizationName         = thirdpartyca, LLC
    #organizationName_default    = Example, LLC
     
    # Use a friendly name here because its presented to the user. The server's DNS
    #   names are placed in Subject Alternate Names. Plus, DNS names here is deprecated
    #   by both IETF and CA/Browser Forums. If you place a DNS name here, then you
    #   must include the DNS name in the SAN too (otherwise, Chrome and others that
    #   strictly follow the CA/Browser Baseline Requirements will fail).
    commonName          = thirdpartyca
    #commonName_default      = Example Company
     
    emailAddress            = ca@thirdpartyca.com
     
     
     
    # Section x509_ext is used when generating a self-signed certificate. I.e., openssl req -x509 ...
    [ x509_ext ]
     
     
    subjectKeyIdentifier        = hash
    authorityKeyIdentifier  = keyid,issuer
     
    # You only need digitalSignature below. *If* you don't allow
    #   RSA Key transport (i.e., you use ephemeral cipher suites), then
    #   omit keyEncipherment because that's key transport.
    basicConstraints        = CA:TRUE
    keyUsage            = Certificate Sign, CRL Sign, digitalSignature, keyEncipherment
    subjectAltName          = @alternate_names
    nsComment           = "OpenSSL Generated Certificate"
     
    # RFC 5280, Section 4.2.1.12 makes EKU optional
    #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused
    #   In either case, you probably only need serverAuth.
    # extendedKeyUsage  = serverAuth, clientAuth
     
    # Section req_ext is used when generating a certificate signing request. I.e., openssl req ...
    [ req_ext ]
     
    subjectKeyIdentifier        = hash
     
    basicConstraints        = CA:FALSE
    keyUsage            = digitalSignature, keyEncipherment
    subjectAltName          = @alternate_names
    nsComment           = "OpenSSL Generated Certificate"
     
    # RFC 5280, Section 4.2.1.12 makes EKU optional
    #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused
    #   In either case, you probably only need serverAuth.
    # extendedKeyUsage  = serverAuth, clientAuth
     
    [ alternate_names ]
     
    DNS.1       = localhost
    DNS.2       = thirdpartyca.com
    #DNS.3       = mail.example.com
    #DNS.4       = ftp.example.com
     
    # Add these if you need them. But usually you don't want them or
    #   need them in production. You may need them for development.
    # DNS.5       = localhost
    # DNS.6       = localhost.localdomain
    # DNS.7       = 127.0.0.1
    
  2. 위의 CA 키를 사용하여 사용자 인증서/키를 만듭니다.
    openssl ecparam -name prime256v1 -genkey -out user.key
    openssl pkcs8 -topk8 -inform PEM -in user.key -outform pem -nocrypt -out user-key.pem
    openssl req -new -key user-key.pem -out user.csr
    openssl x509 -req -days 365 -sha256 -CA ca.pem -CAkey ca-key.pem -CAserial ca.srl -CAcreateserial -in user.csr -out user.crt -extensions x509_ext -extfile openssl.conf
    openssl x509 -in user.crt -out user.pem -outform PEM
    예제 openssl.conf 파일:
    [ req ]
    default_bits        = 2048
    default_keyfile     = tls-key.pem
    distinguished_name  = subject
    req_extensions      = req_ext
    x509_extensions     = x509_ext
    string_mask         = utf8only
    
    # The Subject DN can be formed using X501 or RFC 4514 (see RFC 4519 for a description).
    # Its sort of a mashup. For example, RFC 4514 does not provide emailAddress.
    [ subject ]
    countryName         = CN
    #countryName_default     = US
    
    stateOrProvinceName     = Beijing
    #stateOrProvinceName_default = NY
    
    localityName            = Beijing
    #localityName_default        = New York
    
    organizationName         = thirdpartyca, LLC
    #organizationName_default    = Example, LLC
    
    # Use a friendly name here because its presented to the user. The server's DNS
    #   names are placed in Subject Alternate Names. Plus, DNS names here is deprecated
    #   by both IETF and CA/Browser Forums. If you place a DNS name here, then you 
    #   must include the DNS name in the SAN too (otherwise, Chrome and others that
    #   strictly follow the CA/Browser Baseline Requirements will fail).
    commonName          = admin@thirdpartyca.com
    #commonName_default      = Example Company
    
    emailAddress            = admin@thirdpartyca.com
    #emailAddress_default        = test@example.com
    
    # Section x509_ext is used when generating a self-signed certificate. I.e., openssl req -x509 ...
    [ x509_ext ]
    subjectKeyIdentifier        = hash
    authorityKeyIdentifier  = keyid,issuer
    
    # You only need digitalSignature below. *If* you don't allow
    #   RSA Key transport (i.e., you use ephemeral cipher suites), then
    #   omit keyEncipherment because that's key transport.
    basicConstraints        = CA:FALSE
    keyUsage            = digitalSignature, keyEncipherment
    
    subjectAltName          = @alternate_names
    nsComment           = "OpenSSL Generated Certificate"
    
    # RFC 5280, Section 4.2.1.12 makes EKU optional
    #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused
    #   In either case, you probably only need serverAuth.
    #extendedKeyUsage  = Any Extended Key Usage
    #extendedKeyUsage = serverAuth, clientAuth
    
    
    # Section req_ext is used when generating a certificate signing request. I.e., openssl req ...
    [ x509_ca_ext ]
    subjectKeyIdentifier        = hash
    authorityKeyIdentifier  = keyid,issuer
    
    
    # You only need digitalSignature below. *If* you don't allow
    #   RSA Key transport (i.e., you use ephemeral cipher suites), then
    #   omit keyEncipherment because that's key transport.
    basicConstraints        = CA:TRUE
    keyUsage            = Certificate Sign, CRL Sign, digitalSignature, keyEncipherment
    subjectAltName          = @alternate_names
    nsComment           = "OpenSSL Generated Certificate"
    
    
    # RFC 5280, Section 4.2.1.12 makes EKU optional
    #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused
    #   In either case, you probably only need serverAuth.
    #extendedKeyUsage  = Any Extended Key Usage
    extendedKeyUsage = serverAuth, clientAuth
    
    
    # Section req_ext is used when generating a certificate signing request. I.e., openssl req ...
    [ req_ext ]
    subjectKeyIdentifier        = hash
    basicConstraints        = CA:FALSE
    keyUsage            = digitalSignature, keyEncipherment
    subjectAltName          = @alternate_names
    nsComment           = "OpenSSL Generated Certificate"
    
    
    # RFC 5280, Section 4.2.1.12 makes EKU optional
    #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused
    #   In either case, you probably only need serverAuth.
    #extendedKeyUsage  = Any Extended Key Usage
    #extendedKeyUsage = serverAuth, clientAuth
    
    [ alternate_names ]
    DNS.1       = localhost
    DNS.3       = 127.0.0.1
    DNS.4       = 0.0.0.0
    # Add these if you need them. But usually you don't want them or
    #   need them in production. You may need them for development.
    # DNS.5       = localhost
    # DNS.6       = localhost.localdomain
    # DNS.7       = 127.0.0.1
    # IPv6 localhost
    # DNS.8     = ::1
    
    
Hyperledger Fabric cryptogen 유틸리티를 사용하여 인증서를 만들려면 다음을 수행합니다.
  • 다음은 Hyperledger Fabric 키 자료를 만드는 데 사용되는 cryptogen 명령입니다.
    cryptogen generate --config=./crypto-config.yaml
    예제 crypto-config.yaml 파일:
    # Copyright IBM Corp. All Rights Reserved.
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    # ---------------------------------------------------------------------------
    # "PeerOrgs" - Definition of organizations managing peer nodes
    # ---------------------------------------------------------------------------
    PeerOrgs:
      # ---------------------------------------------------------------------------
      # Org1
      # ---------------------------------------------------------------------------
      - Name: Org1
        Domain: org1.example.com
        EnableNodeOUs: true
        # ---------------------------------------------------------------------------
        # "Specs"
        # ---------------------------------------------------------------------------
        # Uncomment this section to enable the explicit definition of hosts in your
        # configuration.  Most users will want to use Template, below
        #
        # Specs is an array of Spec entries.  Each Spec entry consists of two fields:
        #   - Hostname:   (Required) The desired hostname, sans the domain.
        #   - CommonName: (Optional) Specifies the template or explicit override for
        #                 the CN.  By default, this is the template:
        #
        #                              "{{.Hostname}}.{{.Domain}}"
        #
        #                 which obtains its values from the Spec.Hostname and
        #                 Org.Domain, respectively.
        # ---------------------------------------------------------------------------
        # Specs:
        #   - Hostname: foo # implicitly "foo.org1.example.com"
        #     CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
        #   - Hostname: bar
        #   - Hostname: baz
        # ---------------------------------------------------------------------------
        # "Template"
        # ---------------------------------------------------------------------------
        # Allows for the definition of 1 or more hosts that are created sequentially
        # from a template. By default, this looks like "peer%d" from 0 to Count-1.
        # You may override the number of nodes (Count), the starting index (Start)
        # or the template used to construct the name (Hostname).
        #
        # Note: Template and Specs are not mutually exclusive.  You may define both
        # sections and the aggregate nodes will be created for you.  Take care with
        # name collisions
        # ---------------------------------------------------------------------------
        Template:
          Count: 2
          # Start: 5
          # Hostname: {{.Prefix}}{{.Index}} # default
        # ---------------------------------------------------------------------------
        # "Users"
        # ---------------------------------------------------------------------------
        # Count: The number of user accounts _in addition_ to Admin
        # ---------------------------------------------------------------------------
        Users:
          Count: 1
      # ---------------------------------------------------------------------------
      # Org2: See "Org1" for full specification
      # ---------------------------------------------------------------------------
      - Name: Org2
        Domain: org2.example.com
        EnableNodeOUs: true
        Template:
          Count: 2
        Users:
          Count: 1
    

다음 작업?

적절한 파일을 출력하고 업데이트했는지 확인한 후 Oracle Blockchain Platform 네트워크로 가져올 인증서 파일을 만들 수 있습니다. Create an Organization's Third-Party Certificates File를 참조하십시오.

조직의 타사 인증서 파일 만들기

Oracle Blockchain Platform 네트워크에 가입하려면 조직이 해당 admincert 및 cacert 정보가 포함된 인증서 파일을 작성해야 합니다. 네트워크 설립자는 이 파일을 가져와서 네트워크를 추가합니다.

CA 서버에서 생성한 인증서 파일로 이동하여 인증서 파일을 만드는 데 필요한 정보를 찾습니다. Third-Party Certificate Requirements을 참조하십시오.

인증서 파일은 JSON으로 작성되어야 하며 다음 필드를 포함해야 합니다.

  • mspid - 조직의 이름을 지정합니다.
  • type - 조직이 네트워크 참여자임을 나타냅니다. 이 값은 참가자여야 합니다.
  • admincert - 조직의 관리자 인증서 파일 내용을 포함합니다. 인증서 정보를 JSON 파일로 복사할 때 각 줄을 \n으로 바꿔야 합니다.
  • cacert - 조직의 CA 인증서 파일의 내용을 포함합니다. 인증서 정보를 JSON 파일로 복사할 때 각 줄을 \n으로 바꿔야 합니다.
이렇게 하면 파일을 구조화해야 합니다.
{
  "mspID": "examplemspID",
  "type":  "Participant",  
  "certs": { 
   "admincert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n",
   "cacert": "-----BEGIN CERTIFICATE-----\nexample_certificate\nexample_certificate==\n-----END CERTIFICATE-----\n"
 }
} 
    

Oracle Blockchain Platform 네트워크를 사용할 수 있도록 타사 환경 준비

Oracle Blockchain Platform 네트워크를 사용하려면 먼저 타사 조직의 환경을 설정해야 합니다.

다음 필요 조건 작업이 완료되었는지 확인합니다. 자세한 내용은 타사 인증서가 있는 조직에 Oracle Blockchain Platform 네트워크에 가입하는 일반적인 워크플로우를 참조하십시오.

  • 타사 조직의 인증서 파일이 생성되어 Oracle Blockchain Platform 네트워크 설립자에게 전송되었습니다.
  • 네트워크 설립자가 인증서 파일을 업로드하여 타사 조직을 네트워크에 추가했습니다.
  • 네트워크 설립자는 주문자 서비스의 설정을 내보내고 서비스의 주소와 포트를 타사 조직에 제공했으며 조직에서 이를 환경에 추가했습니다.
  • 네트워크 설립자는 새 채널을 만들어 타사 조직을 추가했습니다.
  • 네트워크 설립자가 체인코드를 설치하고 인스턴스화했습니다.

조직의 환경 설정

타사 조직에서 Oracle Blockchain Platform 네트워크를 성공적으로 사용하려면 먼저 Hyperledger Fabric CLI 또는 SDK를 사용하도록 환경을 설정해야 합니다. Hyperledger Fabric 설명서를 참조하십시오.

체인코드 설치

타사 조직은 피어에 체인 코드를 설치해야 합니다. 그런 다음 이러한 피어가 채널에 조인되어야 체인 코드를 호출할 수 있습니다.

체인코드 배포

필요한 경우 타사 조직은 채널에 체인코드를 배포할 수 있습니다. 예:

export  CORE_PEER_TLS_ENABLED=true
export  CORE_PEER_TLS_ROOTCERT_FILE=$PWD/tls-ca.pem
export  CORE_PEER_MSPCONFIGPATH=$PWD/crypto-config/peerOrganizations/customerorg1.com/users/Admin@customerorg1.com/msp
export  CORE_PEER_LOCALMSPID="customerorg1" 

### gets channel name from input###
CHANNEL_NAME=$1

echo "######### going to instantiate chaincode on channel ${CHANNEL_NAME} ##########"
CORE_PEER_ADDRESS=${peer_host}:${port} peer chaincode instantiate
-o ${peer_host}:${port}  --tls $CORE_PEER_TLS_ENABLED --cafile 
./tls-ca.pem -C ${CHANNEL_NAME}  -n obcs-example02 -v v0 -c '{"Args":["init","a","100","b","200"]}'

체인코드 호출

타사 조직은 Hyperledger Fabric CLI 또는 SDK를 사용하여 체인코드를 호출합니다. 예:

export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_TLS_ROOTCERT_FILE=$PWD/tls-ca.pem
export CORE_PEER_MSPCONFIGPATH=$PWD/crypto-config/peerOrganizations/customerorg1.com/users/User1@customerorg1.com/msp
export CORE_PEER_LOCALMSPID="customerorg1"

### gets channel name from input ###
CHANNEL_NAME=$1

#### do query or invoke on chaincode ####

CORE_PEER_ADDRESS=${peer_host}:${port} peer chaincode query -C
${CHANNEL_NAME} -n $2 -c '{"Args":["query","a"]}'

CORE_PEER_ADDRESS=${peer_host}:${port} peer chaincode invoke -o
${peer_host}:${port} --tls $CORE_PEER_TLS_ENABLED --cafile ./tls-
ca.pem -C ${CHANNEL_NAME} -n $2 -c '{"Args":["invoke","a","b","10"]}'