Skip to content

Add nextcloud-e2ee-verify CLI tool for offline E2EE metadata validation#10079

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/create-validation-tool-plan
Draft

Add nextcloud-e2ee-verify CLI tool for offline E2EE metadata validation#10079
Copilot wants to merge 2 commits into
masterfrom
copilot/create-validation-tool-plan

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

Adds a standalone command-line tool for offline validation of Nextcloud E2EE folder metadata (v2.0+ only). Takes a private key + certificate, decrypts and structurally validates metadata JSON without any server connection or running client.

Summary

src/cmd/e2ee_verify_metadata.cpp (new)

Sequential validation pipeline:

  1. OCS envelope detection and unwrapping
  2. Version guard — rejects < 2.0 immediately
  3. Schema validation — required fields/types for root vs. nested folders
  4. RSA-OAEP-SHA256 metadata key decryption via raw OpenSSL EVP, matched by certificate SHA-256 fingerprint
  5. AES-128-GCM decrypt (tag = last 16 bytes) + gzip decompress using zlib
  6. Decrypted inner JSON structure validation (files, folders, counter, keyChecksums, per-file fields)
  7. Key checksum: SHA-256(key[0..15]) must appear in keyChecksums
  8. Optional detached CMS/PKCS#7 signature verification, mirroring verifySignatureCryptographicMessageSyntax

Nested folder support via --nested --metadata-key <base64> (key inherited from root run).

No libsync/libp11 dependency — crypto is implemented directly with OpenSSL EVP + zlib + Qt::Network (QSslCertificate for cert fingerprinting).

src/cmd/CMakeLists.txt (modified)

Added nextcloud-e2ee-verify target inside if(NOT BUILD_LIBRARIES_ONLY), linking Qt::Core Qt::Network OpenSSL::Crypto ZLIB::ZLIB. No new find_package calls needed.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants