Skip to main content

Public-Private Key Cryptography

In the previous two lessons, we briefly covered what hash functions are and how they are used. Every blockchain (and most non-blockchain applications) use hashing functions, so there are a lot of videos and resources online to help you learn more.

In addition to hashes, we use public-private key cryptography in Fluree as a way to assert identity. Specifically, we use a form of public-private key cryptography that uses an elliptic curve, hence "elliptic-curve cryptography". These next two lessons are a quick introduction. Public-private key cryptography is used widely throughout computing, so there are many resources that delve more deeply into this concept that you can seek out.

Public-Private Key Cryptography

In a network that uses public-private key cryptography, each network member needs to have both a public and a private key in order to participate. This public-private key pair is something that person can generate by themselves (if they know the right algorithm to use).

The private key is, just that, private. A person should never, ever, ever share their private key with anyone.

The public key is designed to be 100% public and shared.

A network member uses their private key to sign their transaction data (message), and this produces a signature.

Diagram showing Alice using her private key to sign a message, and then Bob using Alice's public key and her signature to verify it was Alice who signed it

In the above image, we see that Alice signs her message with her private key, and Bob uses Alice's public key to verify that it was, in fact, Alice who signed the original message.

If you don't have Alice's private key, it is impossible to create a signature that would appear like it was signed by Alice.