<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Encryption on Benjamin Italiaander</title><link>https://tlnd.org/topic/encryption/</link><description>Recent content in Encryption on Benjamin Italiaander</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 29 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://tlnd.org/topic/encryption/index.xml" rel="self" type="application/rss+xml"/><item><title>Clock arithmetic — exercises</title><link>https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/</guid><description>&lt;h1 id="-clock-arithmetic-exercises"&gt;✏️ Clock arithmetic: exercises&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#1-clock-arithmetic"&gt;1. The mathematics, section 1&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01b_easy_forward_hard_backward/"&gt;Easy forward, hard backward →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Everything in public-key cryptography happens on a clock. If this page feels easy, the rest of the series will too. Every exercise has its answer hidden below it: work it out on paper first, then click &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="1-the-remainder"&gt;1. The remainder&lt;/h2&gt;
&lt;p&gt;$a \bmod n$ is the &lt;strong&gt;remainder&lt;/strong&gt; after dividing $a$ by $n$. It is always one of $0, 1, \dots, n-1$.&lt;/p&gt;</description></item><item><title>Contact</title><link>https://tlnd.org/contact/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/contact/</guid><description>&lt;h1 id="-contact"&gt;📬 Contact&lt;/h1&gt;
&lt;p&gt;You can reach me through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;💼 &lt;strong&gt;&lt;a href="https://www.linkedin.com/in/italiaander" class="external-link" target="_blank" rel="noopener"&gt;LinkedIn&lt;/a&gt;&lt;/strong&gt;: send me a message&lt;/li&gt;
&lt;li&gt;🐙 &lt;strong&gt;&lt;a href="https://github.com/Benjamin-Italiaander" class="external-link" target="_blank" rel="noopener"&gt;GitHub&lt;/a&gt;&lt;/strong&gt; and 🦊 &lt;strong&gt;&lt;a href="https://gitlab.com/italiaander" class="external-link" target="_blank" rel="noopener"&gt;GitLab&lt;/a&gt;&lt;/strong&gt;: for anything about my code and notes, open an issue&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="-something-confidential"&gt;🔐 Something confidential?&lt;/h2&gt;
&lt;p&gt;Send me a message on LinkedIn first. I&amp;rsquo;ll send you my public OpenPGP key and its fingerprint, and we check the fingerprint together through a second channel (in person, by phone or on a video call). Then only I can read what you send.&lt;/p&gt;</description></item><item><title>Diffie–Hellman — exercises and in depth</title><link>https://tlnd.org/math/public_key_cryptography/01e_diffie_hellman/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01e_diffie_hellman/</guid><description>&lt;h1 id="-diffiehellman-exercises-and-in-depth"&gt;✏️ Diffie–Hellman: exercises and in depth&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#4-diffiehellman-key-exchange-1976"&gt;1. The mathematics, section 4&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01d_rsa/"&gt;← RSA&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01f_elliptic_curves/"&gt;Elliptic curves in depth →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Diffie–Hellman is the idea that both SSH and TLS rely on for every connection. The formula is one line; the subtle part is &lt;strong&gt;which numbers you may use&lt;/strong&gt;. This page lets you play the exchange, then attack it in three ways, each of which happened to real software. You need &lt;a href="https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/"&gt;clock arithmetic&lt;/a&gt; and &lt;a href="https://tlnd.org/math/public_key_cryptography/01b_easy_forward_hard_backward/#3-generators-and-the-order-of-a-number"&gt;generators&lt;/a&gt;. Answers are hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Digital signatures — exercises and in depth</title><link>https://tlnd.org/math/public_key_cryptography/01g_signatures/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01g_signatures/</guid><description>&lt;h1 id="-digital-signatures-exercises-and-in-depth"&gt;✏️ Digital signatures: exercises and in depth&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#6-digital-signatures-on-a-curve-schnorr--eddsa"&gt;1. The mathematics, section 6&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01f_elliptic_curves/"&gt;← Elliptic curves&lt;/a&gt; · Back to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;1. The mathematics&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Everything here uses part 1&amp;rsquo;s small curve $y^2 = x^3 + 2x + 2 \pmod{17}$ with $G = (5, 1)$ and group order $n = 19$. All &amp;ldquo;signature numbers&amp;rdquo; ($k$, $s$, $e$, $x$) count &lt;strong&gt;modulo 19&lt;/strong&gt;; point coordinates count modulo 17. The table of multiples $kG$ is in &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#53-multiplying-a-point-by-a-number"&gt;part 1&lt;/a&gt;; &lt;a href="https://tlnd.org/math/public_key_cryptography/01f_elliptic_curves/"&gt;Elliptic curves in depth&lt;/a&gt; explains it. Answers are hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Easy forward, hard backward — exercises</title><link>https://tlnd.org/math/public_key_cryptography/01b_easy_forward_hard_backward/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01b_easy_forward_hard_backward/</guid><description>&lt;h1 id="-easy-forward-hard-backward-exercises"&gt;✏️ Easy forward, hard backward: exercises&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#2-easy-forward-hard-backward"&gt;1. The mathematics, section 2&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/"&gt;← Clock arithmetic&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01c_prime_numbers/"&gt;Prime numbers →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Public-key cryptography needs a calculation that is &lt;strong&gt;fast one way and hopeless the other way&lt;/strong&gt;. This page lets you feel both directions with your own hands: first how quick the forward direction is, then how slow going back gets, and finally the clever shortcuts attackers use (and why real keys are big enough to survive them). Answers are hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Elliptic curves and ECDH — the mathematics in depth</title><link>https://tlnd.org/math/public_key_cryptography/01f_elliptic_curves/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01f_elliptic_curves/</guid><description>&lt;h1 id="-elliptic-curves-and-ecdh-the-mathematics-in-depth"&gt;🌀 Elliptic curves and ECDH: the mathematics in depth&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#5-elliptic-curves"&gt;1. The mathematics, section 5&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01e_diffie_hellman/"&gt;← Diffie–Hellman&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01g_signatures/"&gt;Signatures in depth →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Part 1 &lt;em&gt;showed&lt;/em&gt; the addition formulas and a table of points. This page &lt;strong&gt;derives&lt;/strong&gt; them, so you see where every symbol comes from, and then follows the path all the way to X25519, the key exchange your SSH client used the last time you connected to GitHub. You need &lt;a href="https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/"&gt;clock arithmetic&lt;/a&gt; (inverses) and the idea of &lt;a href="https://tlnd.org/math/public_key_cryptography/01e_diffie_hellman/"&gt;Diffie–Hellman&lt;/a&gt;. Exercises have their answers hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Prime numbers — the atoms of cryptography</title><link>https://tlnd.org/math/public_key_cryptography/01c_prime_numbers/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01c_prime_numbers/</guid><description>&lt;h1 id="-prime-numbers-the-atoms-of-cryptography"&gt;🔢 Prime numbers: the atoms of cryptography&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;1. The mathematics&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01b_easy_forward_hard_backward/"&gt;← Easy forward, hard backward&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01d_rsa/"&gt;RSA →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;RSA multiplies two primes. Diffie–Hellman calculates modulo a prime. Curve25519 is named after the prime $2^{255} - 19$. This chapter explains what makes primes so special, proves the two theorems everything rests on, and shows how your computer finds a 1536-bit prime in a fraction of a second. Exercises have their answers hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Public-key cryptography — from the mathematics to SSH, PGP and HTTPS</title><link>https://tlnd.org/math/public_key_cryptography/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/</guid><description>&lt;h1 id="-public-key-cryptography-from-the-mathematics-to-ssh-pgp-and-https"&gt;🔑 Public-key cryptography: from the mathematics to SSH, PGP and HTTPS&lt;/h1&gt;
&lt;p&gt;How can two computers that have never met agree on a secret while everybody is listening? How does a server prove that it is really the server? And what does your SSH key actually &lt;em&gt;do&lt;/em&gt; when you log in?&lt;/p&gt;
&lt;p&gt;Most explanations online give you either the formulas without the protocols, or the commands without the mathematics. This series connects the two. Part 1 builds the mathematics with &lt;strong&gt;small numbers you can check by hand&lt;/strong&gt;. The other parts follow real connections, with real output, and point at the exact formula from part 1 that is doing the work.&lt;/p&gt;</description></item><item><title>Public-key cryptography 1 — The mathematics</title><link>https://tlnd.org/math/public_key_cryptography/01_the_math/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01_the_math/</guid><description>&lt;h1 id="-1-the-mathematics-of-public-key-cryptography"&gt;🔢 1. The mathematics of public-key cryptography&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/02_ssh/"&gt;2. SSH →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Two computers that have never met, talking over a line that everybody can listen to, agree on a secret that nobody else knows. That sounds impossible, and for most of history it was. Since the 1970s it is done billions of times a day: every SSH login, every HTTPS page, every signed software update.&lt;/p&gt;
&lt;p&gt;This part explains the mathematics behind it. Every example uses &lt;strong&gt;small numbers that you can check by hand&lt;/strong&gt; (or in Python: &lt;code&gt;pow(base, exponent, modulus)&lt;/code&gt;). Real systems use the same formulas with numbers of 77 to 925 digits (&lt;a href="https://tlnd.org/math/public_key_cryptography/01h_why_so_many_digits/"&gt;why exactly those sizes?&lt;/a&gt;).&lt;/p&gt;</description></item><item><title>Public-key cryptography 2 — How an SSH connection is built</title><link>https://tlnd.org/math/public_key_cryptography/02_ssh/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/02_ssh/</guid><description>&lt;h1 id="-2-how-an-ssh-connection-is-built"&gt;🔐 2. How an SSH connection is built&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;← 1. The mathematics&lt;/a&gt; · &lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/03_pgp/"&gt;3. OpenPGP →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;part 1&lt;/a&gt; we saw the building blocks: Diffie–Hellman on elliptic curves, signatures, and the hybrid with ML-KEM. Here we follow one real connection, &lt;code&gt;ssh git@github.com&lt;/code&gt;, from the first byte to the moment you are logged in. Every log line on this page is real output of &lt;code&gt;ssh -vv&lt;/code&gt; (OpenSSH 10.2, November 2026), shortened.&lt;/p&gt;</description></item><item><title>Public-key cryptography 3 — How OpenPGP (GnuPG) encrypts and signs</title><link>https://tlnd.org/math/public_key_cryptography/03_pgp/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/03_pgp/</guid><description>&lt;h1 id="-3-how-openpgp-encrypts-and-signs"&gt;✉️ 3. How OpenPGP encrypts and signs&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/02_ssh/"&gt;← 2. SSH&lt;/a&gt; · &lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/04_tls_wireguard_fido2_signal/"&gt;4. TLS, WireGuard, FIDO2 and Signal →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/02_ssh/"&gt;SSH&lt;/a&gt; has a live connection: both sides are online and can do a Diffie–Hellman exchange back and forth. &lt;strong&gt;Email and files do not.&lt;/strong&gt; When you encrypt a file for Bob, Bob may be asleep, and he may read it in five years. There is no &amp;ldquo;back and forth&amp;rdquo;; you have one shot.&lt;/p&gt;</description></item><item><title>Public-key cryptography 4 — TLS, WireGuard, FIDO2 and Signal</title><link>https://tlnd.org/math/public_key_cryptography/04_tls_wireguard_fido2_signal/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/04_tls_wireguard_fido2_signal/</guid><description>&lt;h1 id="-4-tls-wireguard-fido2-and-signal"&gt;🌐 4. TLS, WireGuard, FIDO2 and Signal&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/03_pgp/"&gt;← 3. OpenPGP&lt;/a&gt; · &lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/05_smime/"&gt;5. S/MIME →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/02_ssh/"&gt;SSH&lt;/a&gt; and &lt;a href="https://tlnd.org/math/public_key_cryptography/03_pgp/"&gt;OpenPGP&lt;/a&gt; use the same building blocks from &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;part 1&lt;/a&gt;, but combine them differently, because they solve different problems. Four more protocols you use every day make the differences even clearer. For each: what problem it solves, and which choice in the design follows from that.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="1-tls-13-https"&gt;1. TLS 1.3: HTTPS&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; your browser talks to millions of servers it has never seen before. &amp;ldquo;Trust on first use&amp;rdquo; like SSH (&lt;a href="https://tlnd.org/math/public_key_cryptography/02_ssh/#-do-i-know-this-server-known_hosts"&gt;part 2, ⑤&lt;/a&gt;) does not work: you would have to check a fingerprint for every website.&lt;/p&gt;</description></item><item><title>Public-key cryptography 5 — S/MIME: email encryption with certificates</title><link>https://tlnd.org/math/public_key_cryptography/05_smime/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/05_smime/</guid><description>&lt;h1 id="-5-smime-email-encryption-with-certificates"&gt;✉️ 5. S/MIME: email encryption with certificates&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/04_tls_wireguard_fido2_signal/"&gt;← 4. TLS, WireGuard, FIDO2 and Signal&lt;/a&gt; · &lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are two standards for signing and encrypting email: &lt;strong&gt;OpenPGP&lt;/strong&gt; (&lt;a href="https://tlnd.org/math/public_key_cryptography/03_pgp/"&gt;part 3&lt;/a&gt;) and &lt;strong&gt;S/MIME&lt;/strong&gt;. They use the same mathematics. The big difference is the answer to the question every protocol has to answer: &lt;em&gt;whose key is this?&lt;/em&gt; OpenPGP lets people vouch for each other (or you check a fingerprint yourself); S/MIME uses &lt;strong&gt;certificates from a certificate authority&lt;/strong&gt;, exactly like HTTPS (&lt;a href="https://tlnd.org/math/public_key_cryptography/04_tls_wireguard_fido2_signal/"&gt;part 4&lt;/a&gt;). That makes S/MIME the choice of companies, governments and universities: it is built into Outlook, Apple Mail, Thunderbird and most phones, and an organisation can hand out certificates centrally.&lt;/p&gt;</description></item><item><title>RSA — exercises and in depth</title><link>https://tlnd.org/math/public_key_cryptography/01d_rsa/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01d_rsa/</guid><description>&lt;h1 id="-rsa-exercises-and-in-depth"&gt;✏️ RSA: exercises and in depth&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#3-rsa-1977"&gt;1. The mathematics, section 3&lt;/a&gt; · Previous: &lt;a href="https://tlnd.org/math/public_key_cryptography/01c_prime_numbers/"&gt;← Prime numbers&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/math/public_key_cryptography/01e_diffie_hellman/"&gt;Diffie–Hellman in depth →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Part 1 made one RSA key with $p = 47$ and $q = 59$. Here you make several yourself, prove why it works, see how real software makes it four times faster, and break it in the ways real attackers have. You need &lt;a href="https://tlnd.org/math/public_key_cryptography/01a_clock_arithmetic/"&gt;clock arithmetic&lt;/a&gt; (inverses) and &lt;a href="https://tlnd.org/math/public_key_cryptography/01c_prime_numbers/"&gt;prime numbers&lt;/a&gt; (Euler&amp;rsquo;s φ). Answers are hidden under &lt;strong&gt;Answer&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Why 77 to 925 digits? — how big is big enough</title><link>https://tlnd.org/math/public_key_cryptography/01h_why_so_many_digits/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/public_key_cryptography/01h_why_so_many_digits/</guid><description>&lt;h1 id="-why-77-to-925-digits-how-big-is-big-enough"&gt;📏 Why 77 to 925 digits? How big is big enough&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/math/public_key_cryptography/"&gt;Overview&lt;/a&gt; · Belongs to &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/"&gt;1. The mathematics&lt;/a&gt; and its &lt;a href="https://tlnd.org/math/public_key_cryptography/01_the_math/#7-how-big-is-big-enough"&gt;section 7, key sizes&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The examples in this series use numbers like 23, 2773 and a curve modulo 17, small enough to check by hand. Part 1 says that real systems use &lt;strong&gt;the same formulas with numbers of 77 to 925 digits&lt;/strong&gt;. This page explains where exactly those two numbers come from, and why they are this size: not smaller (then they could be broken) and not bigger (then everything gets slow for nothing).&lt;/p&gt;</description></item><item><title>Backups with BorgBackup</title><link>https://tlnd.org/Linux/backup/borg_backup/</link><pubDate>Sat, 28 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/backup/borg_backup/</guid><description>&lt;h1 id="-backups-with-borgbackup"&gt;🗄️ Backups with BorgBackup&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://www.borgbackup.org/" class="external-link" target="_blank" rel="noopener"&gt;BorgBackup&lt;/a&gt; (borg) is, like &lt;a href="https://tlnd.org/Linux/backup/restic_desktop_backups/"&gt;restic&lt;/a&gt;, a backup program that &lt;strong&gt;encrypts&lt;/strong&gt; everything and stores every piece of data only once (&lt;strong&gt;deduplication&lt;/strong&gt;). After the first backup, a new one only adds what changed, so you can keep a snapshot of every day for years without filling the disk.&lt;/p&gt;
&lt;p&gt;I use borg especially for backups to my &lt;strong&gt;own server&lt;/strong&gt; over SSH: borg on the server side makes it fast, and the server can be locked down so that it can only receive backups.&lt;/p&gt;</description></item><item><title>Desktop Backups with restic (and the 3-2-1 Rule)</title><link>https://tlnd.org/Linux/backup/restic_desktop_backups/</link><pubDate>Sat, 28 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/backup/restic_desktop_backups/</guid><description>&lt;h1 id="-desktop-backups-with-restic"&gt;💾 Desktop backups with restic&lt;/h1&gt;
&lt;p&gt;For servers I use &lt;a href="https://tlnd.org/Linux/backup/tape/bearos-start-point/"&gt;Bareos and tape&lt;/a&gt;. For my own laptop that is far too much: there I use &lt;strong&gt;&lt;a href="https://restic.net/" class="external-link" target="_blank" rel="noopener"&gt;restic&lt;/a&gt;&lt;/strong&gt;. It is one program, it encrypts everything, and it only stores what changed, so a daily backup takes seconds.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="the-3-2-1-rule"&gt;The 3-2-1 rule&lt;/h2&gt;
&lt;p&gt;A backup is only a backup if it survives the disaster:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;&lt;/th&gt;
 &lt;th&gt;Rule&lt;/th&gt;
 &lt;th&gt;Example&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;three copies of your data&lt;/td&gt;
 &lt;td&gt;the original + two backups&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;on two different media&lt;/td&gt;
 &lt;td&gt;laptop SSD + USB disk&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;one copy somewhere else&lt;/td&gt;
 &lt;td&gt;a server, a cloud bucket, or a disk at a friend&amp;rsquo;s house&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;And the hidden fourth rule: &lt;strong&gt;test your restores&lt;/strong&gt;. A backup you have never restored is a hope, not a backup.&lt;/p&gt;</description></item><item><title>How a TOTP Code Is Calculated</title><link>https://tlnd.org/math/totp_explained/</link><pubDate>Sat, 28 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/totp_explained/</guid><description>&lt;h1 id="-how-a-totp-code-is-calculated"&gt;🔢 How a TOTP code is calculated&lt;/h1&gt;
&lt;p&gt;The six digits in your authenticator app (or on your &lt;a href="https://tlnd.org/Linux/yubikey/03_totp_oath/"&gt;YubiKey&lt;/a&gt;, or from &lt;a href="https://tlnd.org/Linux/bash_otp_generator/"&gt;oathtool in the terminal&lt;/a&gt;) are not random. They are calculated from two things: a &lt;strong&gt;shared secret&lt;/strong&gt; and &lt;strong&gt;the current time&lt;/strong&gt;. Your phone and the server both do the same calculation, so they get the same code without ever talking to each other.&lt;/p&gt;
&lt;p&gt;The recipe is open: &lt;strong&gt;HOTP&lt;/strong&gt; (&lt;a href="https://www.rfc-editor.org/rfc/rfc4226" class="external-link" target="_blank" rel="noopener"&gt;RFC 4226&lt;/a&gt;) and &lt;strong&gt;TOTP&lt;/strong&gt; (&lt;a href="https://www.rfc-editor.org/rfc/rfc6238" class="external-link" target="_blank" rel="noopener"&gt;RFC 6238&lt;/a&gt;).&lt;/p&gt;</description></item><item><title>YubiKey 9 — Disk encryption (LUKS) and Git signing</title><link>https://tlnd.org/Linux/yubikey/09_luks_and_git_signing/</link><pubDate>Sat, 28 Nov 2026 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/yubikey/09_luks_and_git_signing/</guid><description>&lt;h1 id="9-disk-encryption-luks-and-git-signing"&gt;9. Disk encryption (LUKS) and Git signing&lt;/h1&gt;
&lt;p&gt;Two more things your YubiKey can do with &lt;strong&gt;FIDO2&lt;/strong&gt;, the same function you used for &lt;a href="https://tlnd.org/Linux/yubikey/04_ssh_fido2/"&gt;SSH in chapter 4&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Unlock your encrypted disk&lt;/strong&gt; at boot: insert the key, type the FIDO2 PIN, touch. No long passphrase any more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sign your Git commits&lt;/strong&gt;, so everyone (and GitHub) can see that a commit really came from you.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Before you start: you need a FIDO2 PIN (&lt;a href="https://tlnd.org/Linux/yubikey/02_first_time_setup/"&gt;chapter 2&lt;/a&gt;), and ideally a &lt;strong&gt;second YubiKey&lt;/strong&gt; as a backup.&lt;/p&gt;</description></item><item><title>YubiKey 5 — OpenPGP: GPG and SSH</title><link>https://tlnd.org/Linux/yubikey/05_openpgp_gpg_ssh/</link><pubDate>Wed, 01 Oct 2025 12:30:21 +0100</pubDate><guid>https://tlnd.org/Linux/yubikey/05_openpgp_gpg_ssh/</guid><description>&lt;h1 id="5-openpgp--gpg--ssh"&gt;5. OpenPGP — GPG + SSH&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/Linux/yubikey/04_ssh_fido2/"&gt;← 4. SSH with FIDO2&lt;/a&gt; · &lt;a href="https://tlnd.org/Linux/yubikey/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/Linux/yubikey/06_age_piv/"&gt;6. age encryption →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a GPG &lt;strong&gt;master key&lt;/strong&gt; that is kept offline,&lt;/li&gt;
&lt;li&gt;three &lt;strong&gt;subkeys&lt;/strong&gt; (Sign, Encrypt, Authenticate) on the YubiKey,&lt;/li&gt;
&lt;li&gt;SSH logins through &lt;code&gt;gpg-agent&lt;/code&gt; with the Authentication subkey,&lt;/li&gt;
&lt;li&gt;multi-hop SSH with &lt;code&gt;ProxyJump&lt;/code&gt; (without agent forwarding).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Before you start:&lt;/strong&gt; &lt;a href="https://tlnd.org/Linux/yubikey/01_installation/"&gt;chapter 1&lt;/a&gt; (incl. Fedora step 5 for the shell settings).&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="51-the-idea-in-one-picture"&gt;5.1 The idea in one picture&lt;/h2&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Master key [C] ──► offline backup (USB in a safe) — only for creating/renewing subkeys
 ├─ Subkey [S] Sign ──► YubiKey slot 1
 ├─ Subkey [E] Encrypt ──► YubiKey slot 2
 └─ Subkey [A] Authenticate ──► YubiKey slot 3 ──► used for SSH
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the commands below, replace &lt;code&gt;&amp;lt;KEYID&amp;gt;&lt;/code&gt; with your key ID or email address.&lt;/p&gt;</description></item><item><title>YubiKey 6 — age encryption (PIV)</title><link>https://tlnd.org/Linux/yubikey/06_age_piv/</link><pubDate>Wed, 01 Oct 2025 12:30:21 +0100</pubDate><guid>https://tlnd.org/Linux/yubikey/06_age_piv/</guid><description>&lt;h1 id="6-age-encryption-piv"&gt;6. age Encryption (PIV)&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://tlnd.org/Linux/yubikey/05_openpgp_gpg_ssh/"&gt;← 5. OpenPGP&lt;/a&gt; · &lt;a href="https://tlnd.org/Linux/yubikey/"&gt;Overview&lt;/a&gt; · Next: &lt;a href="https://tlnd.org/Linux/yubikey/07_linux_login_pam/"&gt;7. Linux login →&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; encrypt files with &lt;a href="https://github.com/FiloSottile/age" class="external-link" target="_blank" rel="noopener"&gt;&lt;code&gt;age&lt;/code&gt;&lt;/a&gt; so that only your YubiKey(s) — or an offline backup key — can decrypt them. A simple alternative to OpenPGP.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="61--post-quantum-note"&gt;6.1 ⚠️ Post-quantum note&lt;/h2&gt;
&lt;p&gt;age with a YubiKey is &lt;strong&gt;not post-quantum (PQ) secure&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Only software age keys with a PQ algorithm (&lt;code&gt;age1pq1…&lt;/code&gt;) are PQ-resistant.&lt;/li&gt;
&lt;li&gt;You &lt;strong&gt;cannot import&lt;/strong&gt; an existing age identity into a YubiKey — it can only generate its own.&lt;/li&gt;
&lt;li&gt;PQ and non-PQ recipients &lt;strong&gt;cannot be mixed&lt;/strong&gt; in one file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;👉 If you need post-quantum encryption, a YubiKey is currently &lt;strong&gt;not the right tool&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>GnuPG</title><link>https://tlnd.org/Linux/GnuPG/</link><pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/GnuPG/</guid><description>&lt;h1 id="the-gnu-privacy-guard"&gt;The GNU Privacy Guard&lt;/h1&gt;
&lt;p&gt;How to encrypt and decrypt a file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# encrypt a file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpg -e -r someone@domain.tld file-to-encrypt.txt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# decrypt a file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpg -d -o secrets.txt file-to-encrypt.txt.gpg
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# encrypt with a password only (no keys needed)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpg -c file-to-encrypt.txt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# sign a file, and check a signature&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpg --detach-sign file.tar.gz &lt;span class="c1"&gt;# creates file.tar.gz.sig&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpg --verify file.tar.gz.sig file.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="gpg-error-unusable-public-key"&gt;GPG Error: Unusable Public Key&lt;/h2&gt;
&lt;p&gt;If you encounter the following error:&lt;/p&gt;</description></item><item><title>Key Derivation Function</title><link>https://tlnd.org/math/key_derivation_function/</link><pubDate>Fri, 28 Oct 2016 00:00:00 +0000</pubDate><guid>https://tlnd.org/math/key_derivation_function/</guid><description>&lt;h1 id="key-derivation-function-kdf"&gt;Key Derivation Function (KDF)&lt;/h1&gt;
&lt;h2 id="cryptographic-key-derivation"&gt;Cryptographic Key Derivation&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Cryptography | Key Management | Password Security&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A &lt;strong&gt;Key Derivation Function (KDF)&lt;/strong&gt; is a cryptographic algorithm used to derive one or more secret keys from an existing secret value.&lt;/p&gt;
&lt;p&gt;This original value may be a master key, password, passphrase, or another form of secret key material.&lt;/p&gt;
&lt;p&gt;KDFs are fundamental components of modern cryptographic systems and are widely used for encryption, authentication, password protection, and secure key management.&lt;/p&gt;</description></item><item><title>How to Set Up Your Own CA with OpenSSL</title><link>https://tlnd.org/Linux/ssl/some-instruction-aboutssl-i-found-online/</link><pubDate>Sun, 03 Jul 2016 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/ssl/some-instruction-aboutssl-i-found-online/</guid><description>&lt;p&gt;I found this useful guide &lt;a href="https://gist.github.com/soarez/9688998" class="external-link" target="_blank" rel="noopener"&gt;here&lt;/a&gt;. Thank you for sharing, &lt;a href="https://uk.linkedin.com/in/soarez" class="external-link" target="_blank" rel="noopener"&gt;Igor Soarez&lt;/a&gt;!&lt;/p&gt;
&lt;h1 id="how-to-set-up-your-own-ca-with-openssl"&gt;How to set up your own CA with OpenSSL&lt;/h1&gt;
&lt;p&gt;For educational reasons I&amp;rsquo;ve decided to create my own CA.
Here is what I learned.&lt;/p&gt;
&lt;h2 id="first-things-first"&gt;First things first&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s get some context first.&lt;/p&gt;
&lt;h2 id="public-key-cryptography"&gt;Public Key Cryptography&lt;/h2&gt;
&lt;p&gt;Public key cryptography, AKA asymmetric cryptography, solves the problem of two entities communicating
securely without ever exchanging a common key, by using two related keys,
one private, one public.&lt;/p&gt;</description></item><item><title>Bash OTP Generator</title><link>https://tlnd.org/Linux/bash_otp_generator/</link><pubDate>Sun, 05 Jun 2016 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/bash_otp_generator/</guid><description>&lt;h1 id="create-an-otp-mfa-tool-in-the-bash-terminal"&gt;Create an OTP MFA Tool in the Bash Terminal&lt;/h1&gt;
&lt;p&gt;I was tired of using &lt;strong&gt;Google Authenticator&lt;/strong&gt;, so I found a simple way to generate my own &lt;strong&gt;OTP (One-Time Password)&lt;/strong&gt; codes directly in &lt;strong&gt;Bash&lt;/strong&gt;.&lt;br&gt;
Just replace the example string below (&lt;code&gt;JHJH...&lt;/code&gt;) with your own secret key.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/bin/oathtool -b --totp &lt;span class="s1"&gt;&amp;#39;JHJHJHJHJHJHJHJHJHJHJHJHJ&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to copy the token directly to your clipboard, just use &lt;strong&gt;xclip&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/bin/oathtool -b --totp &lt;span class="s1"&gt;&amp;#39;JHJHJHJHJHJHJHJHJHJHJHJHJ&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; xclip -selection c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This way, you can easily run your own OTP generator right in the terminal.&lt;/p&gt;</description></item><item><title>Extract the Public Key from a Private Key with OpenSSL</title><link>https://tlnd.org/Linux/ssl/extract-publickey-from-privatekey-openssl/</link><pubDate>Fri, 15 Apr 2016 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/ssl/extract-publickey-from-privatekey-openssl/</guid><description>&lt;h1 id="extract-the-rsa-public-key-from-a-private-key"&gt;Extract the RSA public key from a private key&lt;/h1&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# write the public key to a file (works for RSA, EC and Ed25519 keys)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl pkey -in domain.tld.key -pubout -out domain.tld.pubkey
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# show the public key&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl pkey -in domain.tld.pubkey -pubin -noout -text
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# the same with the RSA-only command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl rsa -in domain.tld.key -pubout -out domain.tld.pubkey
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>OpenPGP / GnuPG Cheat Sheet</title><link>https://tlnd.org/Linux/OpenPGP_GnuPG_cheat_sheet/</link><pubDate>Mon, 14 Mar 2016 00:00:00 +0000</pubDate><guid>https://tlnd.org/Linux/OpenPGP_GnuPG_cheat_sheet/</guid><description>&lt;h1 id="a-short-list-of-important-commands-i-use-with-gnupg"&gt;A short list of important commands I use with GnuPG&lt;/h1&gt;
&lt;h2 id="yubikey-and-gnupg-openpgp--gpg"&gt;YubiKey and GnuPG (OpenPGP / gpg)&lt;/h2&gt;
&lt;p&gt;Start with:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# open the card menu for your YubiKey
gpg --card-edit

# Now enter the admin command
gpg/card&amp;gt; admin

# Now enter help to see all available commands
gpg/card&amp;gt; help
quit quit this menu
admin show admin commands
help show this help
list list all available data
name change card holder&amp;#39;s name
url change URL to retrieve key
fetch fetch the key specified in the card URL
login change the login name
lang change the language preferences
salutation change card holder&amp;#39;s salutation
cafpr change a CA fingerprint
forcesig toggle the signature force PIN flag
generate generate new keys
passwd menu to change or unblock the PIN
verify verify the PIN and list all data
unblock unblock the PIN using a Reset Code
factory-reset destroy all keys and data
kdf-setup setup KDF for PIN authentication
key-attr change the key attribute
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List all keys on a YubiKey, including their keygrips:&lt;/p&gt;</description></item></channel></rss>