Symmetric and asymmetric keys

A symmetric cipher needs one secret that both sides hold. An asymmetric key comes as a pair, and only one half is shared. This set covers making each with openssl, and why real systems use both together rather than picking one.

4 questions 1 task Read the lesson

Questions

Each one is marked as you go, and the explanation arrives straight after, which is the part worth reading.

4 questions, marked as you go.

1 What is the awkward requirement that a symmetric cipher places on two people who want to talk?
2 What does openssl pkey -in priv.pem -pubout -out pub.pem do?
3 Why is RSA not used on its own to encrypt a large file?
4 Which half of an asymmetric key pair is safe to publish, and why?

Tasks

These need your own device. Run the command in Termux, then paste what it printed. The marking looks at what the output means, so spacing, version numbers and ordering do not matter. If you have not installed anything yet, the lesson covers the setup.

Make a symmetric key and an asymmetric pair

This prints a symmetric key, then makes an asymmetric key pair and prints the public half. Compare the two: the first is one value that both sides would share, and the second is the half of a pair that is safe to give away.

Run this in Termux On your own device. Nothing on this page executes it. The command runs in your terminal, and this box only reads what you paste back.

openssl rand -base64 32; echo; openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out "$HOME/demo-key.pem"; echo "private key written"; openssl pkey -in "$HOME/demo-key.pem" -pubout
Marking your own work Both halves of this are checked in your browser, with no server involved, so nothing stops you from pasting output you did not run. The tasks are written so that the easiest way to pass one is to actually do it and read the result, which is the whole intention.

All sets Read the lesson