Encryption

AeroFTP uses encryption at multiple layers to protect data at rest, in transit, and during credential storage. All cryptographic operations execute locally in the Rust backend — no data is ever sent to external services for encryption or key management.

Encryption Architecture Overview

AeroFTP applies encryption across four distinct layers:

LayerPurposePrimary Algorithm
AeroVault v2Encrypted file containersAES-256-GCM-SIV (RFC 8452)
Archive encryptionPassword-protected ZIP/7zAES-256
Credential storagevault.db secretsAES-256-GCM + Argon2id
Transport securityWire encryptionTLS 1.2/1.3, SSH

Each layer operates independently, meaning a vulnerability in one layer does not compromise the others.

AeroVault v2

AeroVault v2 is AeroFTP's proprietary encrypted container format (.aerovault files), designed with a defense-in-depth architecture using seven cryptographic primitives:

ComponentAlgorithmSpecificationPurpose
Key derivationArgon2id128 MiB memory, t=4, p=4Password-to-key derivation
Key wrappingAES-256-KWRFC 3394Master key protection
Content encryptionAES-256-GCM-SIVRFC 8452, 64 KB chunksFile data encryption
Filename encryptionAES-256-SIVRFC 5297Deterministic filename obfuscation
Header integrityHMAC-SHA512RFC 2104Tamper detection on vault header
Cascade mode (optional)ChaCha20-Poly1305RFC 8439Second encryption layer for defense-in-depth
Random number generationOsRngCSPRNGNonce and key generation

Container Format

An AeroVault v2 file has the following structure:

[512-byte header]
  - Magic bytes: "AEROVAULT2"
  - Argon2id salt (32 bytes)
  - Wrapped master key (AES-256-KW)
  - HMAC-SHA512 over header fields

[AES-SIV encrypted manifest]
  - JSON directory listing
  - Per-file metadata (name, size, offset, is_dir)

[Chunked encrypted data]
  - 64 KB chunks, each independently encrypted with AES-256-GCM-SIV
  - Per-chunk random nonce
  - Optional ChaCha20-Poly1305 second layer (cascade mode)

Why AES-256-GCM-SIV

AES-256-GCM-SIV (RFC 8452) is a nonce-misuse-resistant AEAD cipher. Unlike standard AES-GCM, accidental nonce reuse does not catastrophically compromise security — it only leaks whether two plaintexts are identical. This provides a significant safety margin for file encryption where nonce management across thousands of chunks is critical.

Argon2id Parameters

The key derivation parameters exceed OWASP 2024 minimum recommendations:

ParameterAeroVault v2OWASP 2024 Minimum
Memory128 MiB47 MiB (Argon2id)
Iterations (t)41
Parallelism (p)41
Salt length32 bytes16 bytes

AeroVault v2 vs Cryptomator

FeatureAeroVault v2Cryptomator v8
Content encryptionAES-256-GCM-SIV (RFC 8452)AES-256-GCM
Nonce misuse resistanceYesNo
Key derivationArgon2id (128 MiB, t=4, p=4)scrypt (N=32768, r=8, p=1)
Key wrappingAES-256-KW (RFC 3394)AES-256-KW (RFC 3394)
Filename encryptionAES-256-SIVAES-256-SIV
Header integrityHMAC-SHA512HMAC-SHA256
Cascade encryptionChaCha20-Poly1305 (optional)Not available
Chunk size64 KB32 KB
Container formatSingle .aerovault fileDirectory tree with encrypted files
Directory supportYes (hierarchical paths in manifest)Yes (directory nodes)
Remote vault supportYes (download, edit, re-upload)Read-only in AeroFTP

AeroFTP can also open Cryptomator vault format 8 containers as read-only legacy support, using scrypt + AES-256-KW + AES-256-SIV + AES-256-GCM.

Archive Encryption

AeroFTP supports creating and extracting password-protected archives:

FormatEncryption AlgorithmKey DerivationNotes
ZIPAES-256 (WinZip AE-2)PBKDF2-SHA1Industry-standard, wide compatibility
7zAES-256-CBCSHA-256 based (2^19 rounds)Strong encryption, 7-Zip compatible
RARAES-256-CBCPBKDF2-HMAC-SHA256Extract-only (no creation)

Archive passwords are zeroized in memory immediately after use via the secrecy crate's SecretString type. The password is unwrapped only at the point of use (passing to the compression library) and automatically zeroed when the SecretString is dropped.

Credential Storage

All credentials are stored in vault.db, an encrypted SQLite database:

ComponentAlgorithmDetail
EncryptionAES-256-GCMPer-entry encryption with random 96-bit nonce
Key derivationHKDF-SHA256Derives per-purpose keys from master key
Master password KDFArgon2id128 MiB, t=4, p=4 (same as AeroVault)
Database modeSQLite WALConcurrent reads without corruption
Passphrase entropy512-bit CSPRNGAuto-generated if no master password set

See Credential Management for the full credential lifecycle, import/export, and migration details.

Transport Security

Every protocol uses transport-layer encryption where available:

ProtocolEncryptionKey ExchangeAuthentication
SFTPSSH (AES-256-GCM, ChaCha20-Poly1305)Diffie-Hellman, ECDHEd25519, RSA, ECDSA keys
FTPSTLS 1.2/1.3 (explicit or implicit)ECDHECertificate-based
WebDAVTLS 1.2/1.3 (HTTPS)ECDHECertificate-based
S3TLS 1.2/1.3 (HTTPS)ECDHEHMAC-SHA256 (SigV4)
Google DriveTLS 1.2/1.3 (HTTPS)ECDHEOAuth2 Bearer token
DropboxTLS 1.2/1.3 (HTTPS)ECDHEOAuth2 Bearer token
OneDriveTLS 1.2/1.3 (HTTPS)ECDHEOAuth2 Bearer token
MEGATLS 1.2/1.3 + client-side E2EECDHE + RSAPassword-derived key
InternxtTLS 1.2/1.3 + client-side E2EECDHEOAuth2 + zero-knowledge
FilenTLS 1.2/1.3 + client-side E2EECDHEPassword + optional 2FA
Plain FTPNone (cleartext)NonePlaintext password

SFTP Host Key Verification (TOFU)

For SFTP connections, AeroFTP implements Trust On First Use (TOFU) host key verification. On the first connection to a new server, a PuTTY-style dialog displays the SHA-256 fingerprint of the server's host key. The user must explicitly accept the key before the connection proceeds. Subsequent connections verify the stored fingerprint and warn if the key has changed (potential MITM attack).

FTP TLS Downgrade Detection

When connecting via FTP with ExplicitIfAvailable TLS mode, AeroFTP attempts a TLS upgrade. If the upgrade fails (server does not support STARTTLS), the connection falls back to plaintext FTP. In this case, a tls_downgraded flag is set internally and a security warning is logged. The UI displays a TLS badge that dynamically hides when encryption is set to "none".

Warning: Plain FTP transmits credentials and data in cleartext. Always prefer SFTP or FTPS when available.

OAuth Token Protection

OAuth access tokens and refresh tokens for all cloud providers are protected with multiple layers:

  1. SecretString wrapping: All token values are wrapped in Rust's secrecy::SecretString across every provider implementation. This prevents tokens from appearing in debug output, logs, or error messages.

  2. Vault storage: Tokens are stored encrypted in vault.db (AES-256-GCM) at rest.

  3. In-memory fallback: If the vault is locked or unavailable, tokens are held in an in-memory Mutex for the session duration. They are never written to disk unencrypted.

  4. Unwrap-at-use: Tokens are only exposed (via .expose_secret()) at the exact point where they are inserted into HTTP request headers.

  5. Error sanitization: The sanitize_error_message() function uses 5 compiled regex patterns to strip API keys (Anthropic sk-ant-*, OpenAI sk-*), Bearer tokens, and x-api-key values from any error message before it reaches logs or the UI.

Memory Zeroization

AeroFTP uses the secrecy crate for zero-on-drop semantics on all sensitive values:

  • Passwords: Master password, archive passwords, server passwords
  • OAuth tokens: Access tokens, refresh tokens
  • API keys: AI provider keys (OpenAI, Anthropic, etc.)
  • Cryptographic keys: AES keys, HMAC keys, derived keys
  • TOTP secrets: 2FA secret bytes (see TOTP 2FA)

When a SecretString or Secret<Vec<u8>> is dropped, the underlying memory is overwritten with zeros before deallocation. This prevents sensitive data from lingering in freed memory where it could be recovered by memory forensics tools.