coheigea commented on code in PR #3435:
URL: https://github.com/apache/cxf/pull/3435#discussion_r3914236492
##########
rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyDecryptionAlgorithm.java:
##########
@@ -41,22 +42,54 @@ public WrappedKeyDecryptionAlgorithm(Key cekDecryptionKey,
KeyAlgorithm supporte
this.cekDecryptionKey = cekDecryptionKey;
this.supportedAlgo = supportedAlgo;
this.unwrap = unwrap;
+ if (KeyAlgorithm.RSA1_5 == supportedAlgo) {
+ LOG.warning("The RSA1_5 JWE key encryption algorithm is
deprecated: RSAES-PKCS1-v1_5 is"
+ + " vulnerable to padding oracle attacks, consider migrating
to RSA-OAEP");
+ }
}
public byte[] getDecryptedContentEncryptionKey(JweDecryptionInput
jweDecryptionInput) {
KeyProperties keyProps = new
KeyProperties(getKeyEncryptionAlgorithm(jweDecryptionInput));
AlgorithmParameterSpec spec =
getAlgorithmParameterSpec(jweDecryptionInput);
if (spec != null) {
keyProps.setAlgoSpec(spec);
}
- if (!unwrap) {
- keyProps.setBlockSize(getKeyCipherBlockSize());
- return
CryptoUtils.decryptBytes(getEncryptedContentEncryptionKey(jweDecryptionInput),
- getCekDecryptionKey(), keyProps);
+ byte[] fallbackCek = supportedAlgo == KeyAlgorithm.RSA1_5
Review Comment:
@reta It's to prevent
https://en.wikipedia.org/wiki/Adaptive_chosen-ciphertext_attack#Practical_attacks.
By generating a random key and forcing it to be used for decryption we deny
that knowledge back to the attacker.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]