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 ve...@apache.org on 2017/01/29 18:14:29 UTC
svn commit: r1780829 - in
/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder:
AsymmetricBindingBuilder.java BindingBuilder.java
Author: veithen
Date: Sun Jan 29 18:14:29 2017
New Revision: 1780829
URL: http://svn.apache.org/viewvc?rev=1780829&view=rev
Log:
Revert r1780826 (patch for RAMPART-287); this was supposed to go to a branch, not the trunk.
Modified:
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java
axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java
Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java?rev=1780829&r1=1780828&r2=1780829&view=diff
==============================================================================
--- axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java (original)
+++ axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java Sun Jan 29 18:14:29 2017
@@ -284,8 +284,8 @@ public class AsymmetricBindingBuilder ex
+", Signature tool :" + (t2 - t1) );
}
- // Check for signature protection and encrypted supporting tokens
- if (rpd.isSignatureProtection() && this.mainSigId != null || !encryptedTokensIdList.isEmpty()) {
+ // Check for signature protection
+ if (rpd.isSignatureProtection() && this.mainSigId != null) {
long t3 = 0, t4 = 0;
if(tlog.isDebugEnabled()){
t3 = System.currentTimeMillis();
@@ -293,10 +293,9 @@ public class AsymmetricBindingBuilder ex
List<WSEncryptionPart> secondEncrParts = new ArrayList<WSEncryptionPart>();
- if (rpd.isSignatureProtection() && this.mainSigId != null) {
- // Now encrypt the signature using the above token
- secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element"));
- }
+ // Now encrypt the signature using the above token
+ secondEncrParts.add(new WSEncryptionPart(this.mainSigId,
+ "Element"));
if(rmd.isInitiator()) {
for (String anEncryptedTokensIdList : encryptedTokensIdList) {
@@ -304,37 +303,38 @@ public class AsymmetricBindingBuilder ex
}
}
- if (!secondEncrParts.isEmpty()) {
+ Element secondRefList = null;
- Element secondRefList = null;
+ if (encryptionToken.isDerivedKeys()) {
+ try {
- 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));
- }
- }
+ 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));
+ }
}
}
Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java?rev=1780829&r1=1780828&r2=1780829&view=diff
==============================================================================
--- axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java (original)
+++ axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java Sun Jan 29 18:14:29 2017
@@ -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.setSymmetricEncAlgorithm(rpd.getAlgorithmSuite().getEncryption());
+ encrKey.setKeyEncAlgo(rpd.getAlgorithmSuite().getAsymmetricKeyWrap());
+
encrKey.prepare(doc, RampartUtil.getEncryptionCrypto(rpd.getRampartConfig(), rmd.getCustomClassLoader()));
return encrKey;