liveBook · Manning

Symmetric key encryption

As explained in Data Pipelines with Apache Airflow, Second Edition

Symmetric encryption is encryption that uses the same secret key for encryption and decryption.

Symmetric-key encryption uses one secret key to encrypt and decrypt data. In Airflow, a Fernet key protects passwords, connections, and variables stored in the database, so database access alone does not reveal their plaintext values. section 16.2

Apply the technique with disciplined key management:

  • Generate a Fernet key with Python's Fernet.generate_key(). section 16.2
  • Provide the key through AIRFLOW__CORE__FERNET_KEY, or configure AIRFLOW__CORE__FERNET_KEY_CMD to read it from a protected file. section 16.2
  • Protect the key itself: anyone who obtains it can decrypt secrets, while losing it makes encrypted values unrecoverable. section 16.2
  • Recognize its role in HTTPS, where asymmetric encryption helps establish a session key and symmetric encryption protects the subsequent traffic. section 16.4.1

Create and configure an Airflow Fernet key

from cryptography.fernet import Fernet fernet_key = Fernet.generate_key() print(fernet_key.decode()) # Configure the resulting value: AIRFLOW__CORE__FERNET_KEY=<generated-key> For stronger handling, store the key in a read-only file and set AIRFLOW__CORE__FERNET_KEY_CMD to read that file. section 16.2

Figure 16.7 A Fernet key encrypts data before storing it in the database and decrypts data before reading it from the database. Without access to the Fernet key, passwords are useless to an intruder.

Trace how Airflow encrypts secrets before database storage and decrypts them when reading them. section 16.2

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Explains the shared-key model, Fernet configuration, storage flow, and key-loss risks without detailing cipher internals.
Examples
Uses Airflow secret storage, Fernet.generate_key(), environment configuration, protected key files, and HTTPS session keys.
What it assumes
Assumes basic Airflow configuration while defining shared-key encryption and contrasting it with asymmetric encryption.
What you can do after
Operate/configure Airflow secret encryption and explain how HTTPS combines symmetric and asymmetric encryption.
How it connects
Connects symmetric encryption with Fernet, Airflow, database security, HTTPS, TLS, asymmetric encryption, and session keys.

Also explained in

Compare how 6 books explain symmetric key encryption →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.