You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by bi...@apache.org on 2020/04/15 16:09:04 UTC

[axis-axis2-java-rampart] branch RAMPART-287 created (now 7eb53ca)

This is an automated email from the ASF dual-hosted git repository.

billblough pushed a change to branch RAMPART-287
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git.


      at 7eb53ca  RAMPART-287: Apply patch provided by Suresh Attanayake.

This branch includes the following new commits:

     new c25bef8  Create development branch for RAMPART-287.
     new 7eb53ca  RAMPART-287: Apply patch provided by Suresh Attanayake.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[axis-axis2-java-rampart] 01/02: Create development branch for RAMPART-287.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch RAMPART-287
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit c25bef8ec66c3787caf4bd54b9af5bf7d1759612
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Sun Jan 29 17:05:23 2017 +0000

    Create development branch for RAMPART-287.


[axis-axis2-java-rampart] 02/02: RAMPART-287: Apply patch provided by Suresh Attanayake.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch RAMPART-287
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit 7eb53caa19a037d52a9f032d4c9823b9cfbc64e8
Merge: c25bef8 df5ff7f
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Sun Jan 29 18:16:17 2017 +0000

    RAMPART-287: Apply patch provided by Suresh Attanayake.

 .../rampart/builder/AsymmetricBindingBuilder.java  | 74 +++++++++++-----------
 .../org/apache/rampart/builder/BindingBuilder.java |  4 +-
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --cc modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java
index 0572cd6,0572cd6..2708a99
--- a/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java
+++ b/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java
@@@ -284,8 -284,8 +284,8 @@@ public class AsymmetricBindingBuilder e
              				+", Signature tool :" + (t2 - t1) );
              }
  
--            // Check for signature protection
--            if (rpd.isSignatureProtection() && this.mainSigId != null) {
++            // Check for signature protection and encrypted supporting tokens
++            if (rpd.isSignatureProtection() && this.mainSigId != null || !encryptedTokensIdList.isEmpty()) {
              	long t3 = 0, t4 = 0;
              	if(tlog.isDebugEnabled()){
              		t3 = System.currentTimeMillis();
@@@ -293,9 -293,9 +293,10 @@@
  
                  List<WSEncryptionPart> secondEncrParts = new ArrayList<WSEncryptionPart>();
  
--                // Now encrypt the signature using the above token
--                secondEncrParts.add(new WSEncryptionPart(this.mainSigId,
--                        "Element"));
++				if (rpd.isSignatureProtection() && this.mainSigId != null) {
++					// Now encrypt the signature using the above token
++					secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element"));
++				}
                  
                  if(rmd.isInitiator()) {
                      for (String anEncryptedTokensIdList : encryptedTokensIdList) {
@@@ -303,38 -303,38 +304,37 @@@
                      }
                  }
  
--                Element secondRefList = null;
--
--                if (encryptionToken.isDerivedKeys()) {
--                    try {
--
--                        secondRefList = dkEncr.encryptForExternalRef(null,
--                                secondEncrParts);
--                        RampartUtil.insertSiblingAfter(rmd, encrDKTokenElem,
--                                secondRefList);
--
--                    } catch (WSSecurityException e) {
--                        throw new RampartException("errorCreatingEncryptedKey",
--                                e);
--                    }
--                } else {
--                    try {
--                        // Encrypt, get hold of the ref list and add it
--                        secondRefList = encr.encryptForExternalRef(null,
--                                secondEncrParts);
--
--                        // Insert the ref list after the encrypted key elem
--                        this.setInsertionLocation(RampartUtil
--                                .insertSiblingAfter(rmd, encrTokenElement,
--                                        secondRefList));
--                    } catch (WSSecurityException e) {
--                        throw new RampartException("errorInEncryption", e);
--                    }
--                }
--                if(tlog.isDebugEnabled()){
--            		t4 = System.currentTimeMillis();
--            		tlog.debug("Signature protection took :" + (t4 - t3));
--            	}
++				if (!secondEncrParts.isEmpty()) {
++
++					Element secondRefList = null;
++
++					if (encryptionToken.isDerivedKeys()) {
++						try {
++
++							secondRefList = dkEncr.encryptForExternalRef(null, secondEncrParts);
++							RampartUtil.insertSiblingAfter(rmd, encrDKTokenElem, secondRefList);
++
++						} catch (WSSecurityException e) {
++							throw new RampartException("errorCreatingEncryptedKey", e);
++						}
++					} else {
++						try {
++							// Encrypt, get hold of the ref list and add it
++							secondRefList = encr.encryptForRef(null, secondEncrParts);
++
++							// Insert the ref list after the encrypted key elem
++							this.setInsertionLocation(RampartUtil.insertSiblingAfter(rmd,
++									encrTokenElement, secondRefList));
++						} catch (WSSecurityException e) {
++							throw new RampartException("errorInEncryption", e);
++						}
++					}
++
++					if (tlog.isDebugEnabled()) {
++						t4 = System.currentTimeMillis();
++						tlog.debug("Signature protection took :" + (t4 - t3));
++					}
++				}
              }
          }
          
diff --cc modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java
index 6dc753c,6dc753c..5f18311
--- a/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java
+++ b/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java
@@@ -227,8 -227,8 +227,8 @@@ public abstract class BindingBuilder 
              RampartUtil.setEncryptionUser(rmd, encrKey);
  
              //TODO we do not need to pass keysize as it is taken from algorithm it self - verify
--            encrKey.setKeyEncAlgo(rpd.getAlgorithmSuite().getAsymmetricKeyWrap());
--            
++            encrKey.setKeyEncAlgo(rpd.getAlgorithmSuite().getAsymmetricKeyWrap());	
++            encrKey.setSymmetricEncAlgorithm(rpd.getAlgorithmSuite().getEncryption());
              encrKey.prepare(doc, RampartUtil.getEncryptionCrypto(rpd.getRampartConfig(), rmd.getCustomClassLoader()));
              
              return encrKey;