🌍 Python · subject
Python Password Manager Project Syllabus
Every chapter and topic of Password Manager Project examined in Python — 6 chapters, 11 topics and 22 sub-topics, plus 50 flashcards written against it.
Password Manager Project syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Password Manager Project in Python, not a summary of it.
-
Setup Environment
2 topics- Install Required Libraries
- Install cryptography library
- Install SQLite library
- Create Project Structure
- Create main Python file
- Create a directory for storing database file
- Install Required Libraries
-
Database Setup
1 topic- Initialize SQLite Database
- Create connection to SQLite database
- Create table for storing passwords
- Initialize SQLite Database
-
Encryption and Decryption
3 topics- Setup Encryption
- Generate encryption key
- Store encryption key securely
- Encrypt Passwords
- Encrypt passwords before storing in database
- Decrypt Passwords
- Decrypt passwords when retrieving from database
- Setup Encryption
-
User Interface
1 topic- Command-Line Interface
- Create function to add new password
- Create function to retrieve password
- Create function to list all stored accounts
- Command-Line Interface
-
Testing and Debugging
2 topics- Test Encryption and Decryption
- Verify passwords are encrypted before storage
- Verify passwords are correctly decrypted
- Test Database Operations
- Check adding new passwords
- Check retrieving passwords
- Check listing all accounts
- Test Encryption and Decryption
-
Finalization
2 topics- Secure Storage
- Ensure encryption key is stored securely
- Implement additional security measures if necessary
- Documentation
- Document code and usage
- Create README file
- Secure Storage
Password Manager Project flashcards for Python
24 of 50 cards from the Password Manager Project deck — real questions with worked answers.
Which Python library is the standard choice for symmetric encryption in a password manager project, and how is it installed?
The `cryptography` library. Install it with `pip install cryptography`. It provides the `Fernet` class used for authenticated symmetric encryption.
What pip command installs all three common dependencies for a CLI password manager (encryption, env config, and tabular output)?
`pip install cryptography python-dotenv tabulate` — `cryptography` for Fernet encryption, `python-dotenv` to load secrets from a `.env` file, and `tabulate` to print stored entries as a table.
Why is the `sqlite3` module not listed in `requirements.txt` for the password manager?
Because `sqlite3` is part of the Python standard library (built into CPython), so it does not need to be installed via pip and should not appear in `requirements.txt`.
What is the purpose of a `requirements.txt` file in the project structure?
It lists the project's third-party dependencies (with optional pinned versions) so the environment can be reproduced exactly with `pip install -r requirements.txt`.
In a typical password manager project structure, what is the role of a `main.py` (or `cli.py`) file?
It is the entry point that parses command-line arguments and dispatches to the add/get/list/delete functions, tying together the database and encryption modules.
Why should encryption logic be separated into its own module (e.g., `crypto.py`) from database logic (`db.py`)?
Separation of concerns: it keeps responsibilities isolated, makes each module independently testable, and lets you change the storage or encryption implementation without affecting the other.
What is the benefit of creating and activating a Python virtual environment before building the project?
It isolates the project's dependencies from the global Python installation, preventing version conflicts and making the project reproducible. Created with `python -m venv venv`.
Which Python standard-library module is used to connect to and operate on the SQLite database?
The `sqlite3` module. You create a connection with `sqlite3.connect('passwords.db')` and obtain a cursor to execute SQL.
Write the SQL statement to create a `passwords` table storing an id, service name, username, and an encrypted password.
$$\texttt{CREATE TABLE IF NOT EXISTS passwords (id INTEGER PRIMARY KEY AUTOINCREMENT, service TEXT NOT NULL, username TEXT NOT NULL, password BLOB NOT NULL);}$$
After executing INSERT, UPDATE, or DELETE statements with sqlite3, what method must you call to persist the changes?
`conn.commit()` — without committing, the changes remain in the transaction and are lost when the connection closes.
Why is the `IF NOT EXISTS` clause used in the `CREATE TABLE` statement during database initialization?
It makes initialization idempotent: the table is created only if it does not already exist, so running the init routine multiple times does not raise an error or overwrite data.
What SQLite column type should store the encrypted password bytes, and why?
`BLOB`, because Fernet output is raw bytes (a token). Storing it as BLOB preserves the binary token exactly; alternatively the token can be decoded to text and stored as TEXT.
Why should you use parameterized queries (e.g., `cursor.execute(sql, (value,))`) instead of string formatting in SQL?
Parameterized queries prevent SQL injection by safely binding values, and they correctly handle quoting and special characters in the data.
What is symmetric encryption, and why is it appropriate for a personal password manager?
Symmetric encryption uses the same single key to encrypt and decrypt data. It is appropriate because a single user holds the one key for both storing and retrieving their own passwords.
What does the `Fernet` class in the `cryptography` library provide?
Fernet provides authenticated symmetric encryption: it encrypts data with AES-128 in CBC mode, adds an HMAC for integrity, includes a timestamp, and produces a URL-safe base64 token.
How do you generate a new Fernet encryption key in Python?
`from cryptography.fernet import Fernet` then `key = Fernet.generate_key()`. This returns a 32-byte, URL-safe base64-encoded key.
How is a Fernet cipher object instantiated from an existing key?
`cipher = Fernet(key)` where `key` is the previously generated base64-encoded key (as bytes). The same key must be reused to decrypt previously encrypted data.
What underlying symmetric cipher and mode does Fernet use, and what key size?
Fernet uses AES in CBC mode with a 128-bit ($128$-bit) key for encryption, plus HMAC-SHA256 for authentication. The full Fernet key is 256 bits split into a signing key and an encryption key.
What is the danger of losing the Fernet key after passwords have been encrypted with it?
Without the key, the encrypted data is permanently unrecoverable — decryption is computationally infeasible. There is no recovery, so the key must be backed up securely.
Which Fernet method encrypts data, and what input type does it require?
`cipher.encrypt(data)` — it requires the plaintext as `bytes`. A string must first be encoded, e.g. `password.encode()`.
Write the two-line Python pattern to encrypt a plaintext password string into a Fernet token.
``` token = cipher.encrypt(password.encode()) # token is bytes; store in the database ```
What does a Fernet token contain besides the ciphertext?
A version byte, a timestamp (when the token was created), the 16-byte IV, the AES-CBC ciphertext, and a 32-byte HMAC signature — all base64url-encoded together.
Why must a string be encoded with `.encode()` before passing it to `Fernet.encrypt()`?
Because `Fernet.encrypt()` operates on `bytes`, not `str`. `.encode()` converts the string to UTF-8 bytes; passing a `str` raises a `TypeError`.
Which Fernet method decrypts a token, and what does it return?
`cipher.decrypt(token)` returns the original plaintext as `bytes`. Call `.decode()` to convert it back to a string.
Planning Password Manager Project for Python
Password Manager Project is about 5% of the Python syllabus by topic count — 11 of 242 topics, spread over 6 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 15 hours.
The heaviest chapters are Encryption and Decryption (3 topics), Setup Environment (2 topics), Testing and Debugging (2 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.
Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.
Password Manager Project (Python) FAQ
What is in the Python Password Manager Project syllabus?
Password Manager Project is split into 6 chapters — Setup Environment, Database Setup, Encryption and Decryption, User Interface, Testing and Debugging and Finalization, containing 11 topics and 22 sub-topics in total.
How is Password Manager Project structured in the Python syllabus?
6 chapters. Password Manager Project accounts for about 5% of the topics in the whole Python syllabus (11 of 242).
How long should I spend on Password Manager Project for Python?
Budget around 15 hours for a first pass through Password Manager Project — about 45 minutes per topic plus 12 minutes per sub-topic across its 11 topics. Add revision cycles on top.
Are there flashcards for Python Password Manager Project?
Yes — a 50-card Password Manager Project deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.