-
Notifications
You must be signed in to change notification settings - Fork 0
Description
How do you verify that the GPG encryption uses strong algorithms and that only the intended key IDs are authorized for decrypting passphrase files?
Analysis:
-
Key ID Authorization: The application correctly uses the
--recipientflag in itsgpgcommand within theFileKeyStore.setmethod. This ensures that GPG encrypts the passphrase file for a specific recipient's public key, and only the corresponding private key (identified byconfig.gpg_recipient) can decrypt it. This is the correct approach for authorizing specific keys. -
Algorithm Strength: The application does not enforce the use of strong cryptographic algorithms. The
gpgcommand inFileKeyStore.setlacks parameters to specify the cipher, digest, or compression algorithms. It therefore falls back to the user's system-wide or user-specific GPG configuration (gpg.conf). If these defaults are weak or outdated (e.g., 3DES, SHA-1, CAST5), the passphrase files will be encrypted with weak protection, even if the GPG key itself is strong.
Recommendations:
-
Enforce Strong Algorithms: Modify the
gpgcommand inFileKeyStore.setto explicitly specify strong, modern algorithms. This removes reliance on system defaults and guarantees a secure baseline.# In luks_keeper/keys.py, class FileKeyStore, method set() subprocess.run( [ "gpg", "--batch", "--yes", "--cipher-algo", "AES256", # Enforce AES256 "--digest-algo", "SHA256", # Enforce SHA256 "--encrypt", "--recipient", self.recipient, "--output", path ], input=plaintext.encode(), check=True )
-
Make Algorithms Configurable: For better flexibility, define the recommended algorithms as defaults in
luks_keeper/config.pyand allow users to override them if necessary.