Public and private key pairs lie at the core of how we do encryption here at PreVeil. They are the basis for the end-to-end encryption we use as well as asymmetric cryptography in general.

We often find ourselves explaining the concepts of how these keys work when we talk to prospective clients. So, we thought it would be helpful to discuss what these keys are, what they aren’t and how they work.

The answers below provide a general overview on public and private key pairs rather than an architectural overview of PreVeil. For a detailed understanding of how public-private key pairs work in PreVeil, please review our architectural whitepaper.

##### What are public-private keys

The public key is, as its name implies, public and open to anyone in the system. The public key is used to encrypt data. The private key however is private. It is stored on user’s device and is used to decrypt data.

*What’s the difference between a public and private key?*

The public and private key are really large prime numbers that are mathematically related to one another but are not the same. Being related in this case means that whatever is encrypted by the public key can only be decrypted by the related private key.

A person cannot guess the private key based on knowing the public key. Because of this, a public key can be freely shared. The private key however belongs to only one person.

There are several well-known mathematical algorithms that are used to produce the public and private key. Some well-respected examples of public private key encryption are RSA, DSS (Digital Signature Standard) and various elliptic curve techniques. At PreVeil, we use elliptic-curve cryptography’s Curve-25519 and NIST P-256.

##### What public-private keys are not

*How does asymmetric differ from symmetric encryption*

Asymmetric encryption uses a different key (a public key) to encrypt and decrypt (a private key) data. Symmetric encryption however uses the same key to encrypt and decrypt. This doesn’t mean however that symmetric encryption is weaker than asymmetric encryption. What it does mean though is that symmetric encryption takes less computing power and is thus faster than asymmetric encryption.

The Diffie-Helman key exchange is a famous example of how symmetric keys can be created and shared between Alice and Bob. Diffie-Hellman is a way of generating a shared secret (key) between two people in such a way that the secret can’t be seen by observing the communication. You’re not sharing information during this key exchange. Instead you’re creating a key together.

##### How public-private keys work

Here’s an example of how a public and private key work.

Bob wants to send Alice an encrypted message. To do this, Bob takes Alice’s public key and encrypts his message to her. Then, when Alice receives the message, she takes the private key that is known only to her in order to decrypt the message from Bob and reads it.

Although the companies owning the server might try to read the message, they will be unable to because they lack the private key to decrypt the message. Only Alice will be able to decrypt the message as she is the only one with the private key.

When Alice wants to reply, she simply repeats the process, encrypting her message to Bob using Bob’s public key.

The public and private key can also be used to create a digital signature. A digital signature assures that the person sending the message is who they claim to be.

Digital signatures ensure Mike can’t pretend that he is Bob by using Bob’s public key to send a message to Alice.

To create a digital signature using a public and private key, Bob digitally signs his email to Alice using his private key. When Alice receives the message from Bob, she can verify the digital signature on the message came from Bob by using his public key. As the digital signature uses Bob’s private key, Bob is the only person who could create the signature.

PreVeil’s method for securing messages is a bit more complex than the example provided above. However the example provides a good general overview for how asymmetric encryption works.

##### Examples of public private key encryption.

Many protocols like SSH, OpenPGP, S/MIME, and SSL/TLS rely on asymmetric cryptography for encryption and digital signatures. It is also used in software programs, such as browsers, to establish secure connections over an insecure network like the internet.

PreVeil is one example platform that uses public and private keys to encrypt data and create digital signatures. Other well-known applications that use public and private keys to secure messages are WhatsApp and Signal.

##### Business benefits of public private key encryption

By using a public and private key for encryption and decryption, recipients can be confident that the data is what the sender says it is. The recipient is assured of the confidentiality, integrity and authenticity of the data.

**Confidentiality **is ensured because the content that is secured with the public key can only be decrypted with the private key. This ensures that only the intended recipient can ever review the contents

**Integrity** is ensured because part of the decryption process requires checking that the received message matches the sent message. This ensures that the message has not been changed in between.

**Authenticity **is ensured because each message sent by Alice to Bob is also signed by Alice’s private key. The only way to decrypt Alice’s private key is with her public key, which Bob can access. By signing the message with her private key, Alice ensures the authenticity of the message and shows that it really did come from her.

##### Conclusion

Interested in reading more about public private keys? Look at our articles on: