jrihtarsic commented on code in PR #234:
URL: 
https://github.com/apache/santuario-xml-security-java/pull/234#discussion_r1427582820


##########
src/main/java/org/apache/xml/security/encryption/XMLCipher.java:
##########
@@ -1364,26 +1377,41 @@ public EncryptedKey encryptKey(
         } else {
             c = contextCipher;
         }
-        // Now perform the encryption
 
+        AlgorithmParameterSpec chiperSpec = null;
+        KeyPair origninatorKeyPair = null;
+        Key wrapKey = this.key;
+        if (params instanceof OAEPParameterSpec) {
+            chiperSpec = params;
+            wrapKey = this.key;
+        } else if (params instanceof KeyAgreementParameterSpec) {
+            KeyAgreementParameterSpec keyAgreementParameter = 
(KeyAgreementParameterSpec) params;
+            PublicKey recipientPublicKey = (PublicKey) this.key;
+            if (keyAgreementParameter.getRecipientPublicKey() == null) {
+                
keyAgreementParameter.setRecipientPublicKey(recipientPublicKey);
+            }
+            if (keyAgreementParameter.getOriginatorPrivateKey() == null) {
+                origninatorKeyPair = 
KeyUtils.generateEphemeralDHKeyPair(recipientPublicKey, null);

Review Comment:
   You are right, fixed and added new method
   validateAndUpdateKeyAgreementParameterKeys
    with additional validation of the Key Agreement Parameter Keys



-- 
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]

Reply via email to