Without an AssertionEncrypter, the IdP always encrypted assertions with
RSA-OAEP-MGF1P and AES-128-CBC, even for service providers whose metadata
lists AES-GCM for their encryption key, as this package's ServiceProvider
does. AES-CBC has no integrity protection, which exposes the XML
Encryption padding and parse oracles.
The default now picks the block cipher the way the IdP already does for
encrypted logout NameIDs: the first of AES-256-GCM, AES-128-GCM,
AES-192-GCM, AES-256-CBC, AES-128-CBC and AES-192-CBC that the SP's
metadata lists. Key transport stays RSA-OAEP-MGF1P with SHA-1, which all
implementations support.
Compatibility: an SP whose metadata lists none of those block ciphers
still gets AES-128-CBC, since many SPs that do not list their algorithms
cannot decrypt AES-GCM. An SP that lists AES-GCM now receives it.
Tests: the tests that compare an encrypted assertion with a golden file now
configure the previous AES-128-CBC encrypter, so their golden files are
unchanged. New tests check the default end to end, decrypting the result:
AES-256-GCM for this package's SP, AES-128-CBC for an SP that lists no
block cipher, and a configured encrypter used as is.
Claude-Session: https://claude.ai/code/session_01QFDLnwoFqoKsDdz8uKiq5V
Co-authored-by: Claude <noreply@anthropic.com>