concept certificate in category blockchain

appears as: certificates, certificate, A certificate, The certificate, certificate
Blockchain in Action

This is an excerpt from Manning's book Blockchain in Action.

In this chapter, let’s put all these concepts together, not only to reinforce the concepts discussed, but also to comprehend how and why blockchain programming is different from traditional web application development.

Figure 11.10 Opening screen, DCC-Dapp
Permissioned Blockchains in Action

This is an excerpt from Manning's book Permissioned Blockchains in Action.

When considering, for instance, building a system for issuing and verifying credentials, the answer is not as simple. Credentials are only worth something when the issuers are limited - universities where you can obtain your master’s degree, local authorities that can attest to you owning a property, etc. If anyone could claim being a pilot, the airplanes would no longer be the safest means of transportation out there. On the other end, the barrier to verification should be as low as possible, and anyone should be able to verify that you have the certificate you claim you have (assuming you consent to this verification). Thus, Universities today are experimenting with Permissioned Public blockchains for storing their issued degrees.

Trust questions aside, how does this certificate authority tell you to trust a key? There are two steps to this process: first the user generates a certificate using her key pair. A certificate is just a standardized data format that encodes the user’s real-life identity (Organization, country, name, etc.) alongside her public key. The certificate authority then takes this certificate and signs it using its private key and hands it back to the user or broadcasts it to the world. The certificate thus, now has a stamp of approval from the CA and as long as you trust that CA, you will trust this certificate and the key within it.

Creating a certificate

The procedure for creating a certificate is pretty much identical to that of generating a public key except with the insertion of some additional information and using a different output format. In fact, we can generate keys and the associated certificate all in one command:

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt

You will be prompted to fill in a lot of fields, you can just choose to skip them by simply pressing enter. Once you spam your enter key enough number of times, you’ll see two new files in your directory. The .key file is the newly generate private key and the .crt is the certificate. Let’s dissect the command we just issued: the req keyword is used to either generate a “self-signed” certificate (where you are your own issuer) or certificate requests (a request to an authority to give you a certificate). The -x509 option that follows tells it to issue a self-signed certificate instead of a request, -sha256 specifies the format of the message digest (we’ll come to this later on in the book), -nodes tells it to not encrypt the private key file (confusingly, that’s “no DES”, not “nodes”!), -days indicates how many days this certificate is valid for, -newkey rsa:2048 together tells openSSL to generate a new key using the RSA algorithm with a key length of 2048, -keyout points to the file where the key is stored and finally -out points to where the certificate should be stored. Phew! That was a long command, let’s see what it gave us by opening the files in text editor. Figure 3.5 shows what a certificate file could look like, the private key file will look the same as in the key pair file.

Figure 3.5 Example contents of certificate.crt

If you are sitting there and thinking, “Doesn’t a certificate require a signature from a CA?”, then congratulations, you have been paying attention! The certificate we’ve generated is a special kind of certificate called a self-signed certificate. As the name suggests, the certificate is signed by its own private key. This is useful not only as a demo but also for creating root CAs – when you’re the CA yourself, you’re identified by your self-signed certificate.