[
https://issues.apache.org/jira/browse/WICKET-7190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105623#comment-18105623
]
ASF subversion and git services commented on WICKET-7190:
---------------------------------------------------------
Commit 6b85d7c81a1db49e976f74dd5cd4c6b5b919c561 in wicket's branch
refs/heads/master from Emond Papegaaij
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=6b85d7c81a ]
WICKET-7190 Let the crypt scheme generate its own key
A factory cannot know what key material an encryption scheme needs, so key
generation is moved from the factories onto the scheme:
- ICryptScheme gains an abstract generateKey(SecureRandom). The scheme owns the
key material; a factory only decides where the key lives (per session, global,
externally supplied). All schemes sharing one SchemeCrypt must produce
compatible keys, since existing ciphertext is decrypted with the current key
during migration.
- New AbstractAesGcmCryptScheme carries everything the AES-256 GCM-family
schemes
share: the 256-bit AES key generation and the encrypt/decrypt flow (12-byte
nonce, 128-bit tag, nonce||ciphertext||tag layout, marker authenticated as
associated data). AesGcmCryptScheme and AesGcmSivCryptScheme now only supply
id(), the Cipher and the AlgorithmParameterSpec, removing the duplication that
existed between them.
All four call sites that previously hardcoded
CipherUtils.generateKey("AES", 256, ...) now delegate to the configured scheme:
- AbstractCryptFactory gains a protected generateKey(random) helper resolving
the
scheme from SecuritySettings; KeyInSessionCryptFactory uses it.
- ApplicationKeyCryptFactory(SecureRandom) generates its key lazily on first use
(so the scheme is configured by then) and caches it; the (SecretKey)
external-key constructor is unchanged.
- SecuritySettings.getAuthenticationStrategy() and CryptingPageStore both ask
the
scheme for the key.
Tests: SchemeCryptTest verifies generateKey yields a usable 256-bit AES key that
round-trips; CryptFactoryTest covers the lazy application-random-key path.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
> Unified cryptography API
> ------------------------
>
> Key: WICKET-7190
> URL: https://issues.apache.org/jira/browse/WICKET-7190
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Emond Papegaaij
> Assignee: Emond Papegaaij
> Priority: Major
> Fix For: 11.0.0
>
>
> The current cryptography API in Wicket is split over {{ICrypt}} and
> {{ICrypter}}. Both APIs serve a similar purpose but for different subsystems.
> The goal is to unify these APIs and to allow the implementation of more
> modern ciphers, with AEAD support. Also, the documentation on this API and
> its implementations must be improved, clearly stating what it does and what
> it does not deliver.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)