Skip to content

Class 1 - Cryptography

References:

  1. CYBERSECURITY

  2. Overview of Cryptography Concepts

Create a public/private key pair.

What is the public key?

It is a cryptographic key that is shared publicly. Anyone can use it to encrypt messages intended for you or to verify your digital signatures.

What is the private key?

It is a secret cryptographic key that belongs exclusively to you. It is used to decrypt messages encrypted with your public key or to create digital signatures.

What can this key pair be used for?

It is used for asymmetric cryptography, which enables secure data encryption, digital signatures (for identity verification), and secure network authentication (like SSH or HTTPS).

Why must the private key be protected?

If someone gains access to your private key, they can decrypt your confidential data, impersonate your identity, and falsely sign transactions or documents in your name.

The Ed25519 algorithm is recommended for modern systems because it is faster and more secure than RSA.

create_private_key

ssh-keygen -t ed25519 -C "dummy@email.com"

cat dummy.pub

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFBfIz1I6PT02L6qEkKpVE4y+fVpgLUhJs1GxECqcfSM dummy@email.com

Install an SSH public key on a server and use it to log in.

How does SSH key authentication work?

What is stored on the server?

What stays on your own computer?

Why does the server not need your private key?

cat ~/dummy.pub >> ~/.ssh/authorized_keys

chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

scp ubuntu@192.168.80.250:~/dummy .\dummy_clean

ssh -i .\dummy_clean ubuntu@192.168.80.250

Encrypt and decrypt a file.

Did you use symmetric or public-key encryption?

Where did the key come from?

Who can decrypt the file?

What happens if the key or password is lost?

Encrypt a disk, USB stick, directory, or filesystem.

What exactly is encrypted?

When is the data decrypted?

What does this protect against?

What does it not protect against?

Create a file, compute its hash, change the file, and compute the hash again.

What changed?

Why are hashes useful?

Why does a hash not prove who created the file?

How could hashes be used to detect tampering?

Sign a file or message and verify the signature.

What does the signature prove?

What does it not prove?

Why is the message usually hashed before signing?

What happens if the signed file is changed?

Send a digitally signed email.

How can the recipient verify the signature?

What key or certificate do they need?

Is the email encrypted, signed, or both?

What is the difference between signing and encrypting?

Install a certificate on a web server, or inspect the certificate of an HTTPS website.

Why does the server send a certificate instead of just a public key?

What role does the Certificate Authority play?

What attack does this help prevent?

Show or describe how to encrypt a long message for someone using their public key.

Why is the whole message usually not encrypted directly with the public key?

What is a symmetric key?

How is the symmetric key protected?

Why is this called hybrid encryption?