Skip to content

Closed - #36

Closed
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-sodium-random-nonce
Closed

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-sodium-random-nonce

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

Cipher\Sodium used the nonce set through setNonce() for every message of
the instance and did not store it, so encrypting two messages with the same
key reused the nonce, which breaks XSalsa20-Poly1305. Without a nonce set,
encrypt() now generates a random nonce per message and prepends it to the
ciphertext, and decrypt() splits it off. Until now that case threw an
exception, so existing callers are unaffected. setNonce() is deprecated and
only kept to decrypt data encrypted with a fixed nonce. Nonces of the wrong
length are rejected with a clear message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hackwar Hackwar closed this Nov 13, 2026
@Hackwar Hackwar changed the title [4.x] Use a random nonce per message in the Sodium cipher Closed Nov 13, 2026
@Hackwar
Hackwar deleted the 4.x-sodium-random-nonce branch November 13, 2026 12:50
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.

1 participant