Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Web Crypto API instead of SJCL #1098

Open
jelhan opened this issue Mar 3, 2025 · 0 comments
Open

Use Web Crypto API instead of SJCL #1098

jelhan opened this issue Mar 3, 2025 · 0 comments
Labels
Milestone

Comments

@jelhan
Copy link
Owner

jelhan commented Mar 3, 2025

The web platform didn't supported encryption when Croodle development started. Therefore it uses the Stanford JavaScript Crypto Library (SJCL) for encryption.

These days all browser support the Web Crypto API. We should use that native API for deriving the key from the passphrase, encrypting the user input and decrypting it. It provides better security, does not require shipping additional code over the wire, and has better performance.

Sadly it's not a drop in replacement. Croodle uses AES in CCM mode today. The Web Crypto API does not support CCM mode. We need switching to AES in GCM mode, which provides the same security (authenticated encryption).

To keep backward compatibility with existing polls, we should introduce a new encryption format and fallback to SJCL in case the poll was created with the old format. We can import SJCL dynamically to avoid shipping it's code over the wire if not needed.

Key derivation is not impacted. We use PBKDF2 today, which is supported by Web Crypto API.

@jelhan jelhan added the internal label Mar 3, 2025
@jelhan jelhan added this to the v0.8 milestone Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant