Tuesday, July 30, 2019

What are the Digital Signatures

The actually signing probably depends on what kind of certificate it is. this is a useful read.
A digital certificate consists of three things:
  • A public key.
  • Certificate information. ("Identity" information about the user, such as name, user ID, and so on.)
  • One or more digital signatures.
Typically the "one of more digital signatures" part is done by listing an set of encrypted hashes of the certificate. So when you want to sign a certificate, you would compute the hash of the certificate, encrypt it using your private signing key, and add it to the list of digital signatures.
 So in a sense, that the certificate is a production of a private key applied to a bunch of information. So whoever receive that certificate will be able to see that person's public key, identity information, then will be able to use the public key to digest the digital signature to make sure that the hash come out of the decrypted digital signature match the certificate part of identity part of the information. so that you know this is real.

Thursday, July 18, 2019

How to create cds file

Assume that your chaincode is in a directory named node, and use the following command to generate the cds file.

1. Cd to the directory which is the parent directory of the node directory
2. Run the following command:

docker run --rm --name peer --entrypoint peer -v $(pwd):/mychaincode hyperledger/fabric-peer chaincode package -n mycc -p /mychaincode/node -l node -v 1.0.0 /mychaincode/test.cds

This creates a file named test.cds in the current directory named mycc with version 1.0.0

Friday, July 12, 2019

Setup dev environment for k8s operator

The process is to setup k8s operator dev environment

1. Install docker, kubectl, golang and mercurial etc. using the method from each product
2. Setup git config if you have not:
    git config --global user.email "your email address here"
    git config --global user.name "Tong Li"  
3. Add the following to the end of your .profile:

    export PATH=$PATH:/usr/local/go/bin
    export GOROOT=/usr/local/go
    export GOBIN=$GOROOT/bin
    export GOPATH=~/hl
    export GO111MODULE=on
    The above assumes that your golang is installed in to /usr/local/go directory and you have
    a directory in your home named hl

4. To be able to create an operator, you will need to first create a directory under $GOPATH, the run the operator creation command:

   mkdir $GOPATH/myproject
   cd $GOPATH/myproject
   operator-sdk new myfirst