ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1770741 - in /webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message: WSSecDKEncrypt.java WSSecEncrypt.java
Date Mon, 21 Nov 2016 19:23:52 GMT
Author: coheigea
Date: Mon Nov 21 19:23:52 2016
New Revision: 1770741

URL: http://svn.apache.org/viewvc?rev=1770741&view=rev
Log:
Fixing last merge

Modified:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java?rev=1770741&r1=1770740&r2=1770741&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
Mon Nov 21 19:23:52 2016
@@ -48,8 +48,6 @@ public class WSSecDKEncrypt extends WSSe
 
     private List<Element> attachmentEncryptedDataElements;
     
-    private WSSecHeader securityHeader;
-
     public WSSecDKEncrypt() {
         super();
     }
@@ -67,8 +65,6 @@ public class WSSecDKEncrypt extends WSSe
 
     public Document build(Document doc, WSSecHeader secHeader) throws WSSecurityException
{
 
-        securityHeader = secHeader;
-        
         //
         // Setup the encrypted key
         //
@@ -90,7 +86,7 @@ public class WSSecDKEncrypt extends WSSe
                 );
             parts.add(encP);
         }
-        Element externRefList = encryptForExternalRef(null, parts);
+        Element externRefList = encryptForExternalRef(null, parts, secHeader);
 
         addAttachmentEncryptedDataElements(secHeader);
 
@@ -110,6 +106,10 @@ public class WSSecDKEncrypt extends WSSe
         }
     }
 
+    public Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> references)
{
+        return encryptForExternalRef(dataRef, references);
+    }
+
     /**
      * Encrypt one or more parts or elements of the message (external).
      * 
@@ -128,10 +128,11 @@ public class WSSecDKEncrypt extends WSSe
      * 
      * @param dataRef A <code>xenc:Reference</code> element or <code>null</code>
      * @param references A list containing WSEncryptionPart objects
+     * @param secHeader the security header element to hold the encrypted key element.
      * @return Returns the updated <code>xenc:Reference</code> element
      * @throws WSSecurityException
      */
-    public Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> references)
+    public Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> references,
WSSecHeader secHeader)
         throws WSSecurityException {
         
         KeyInfo keyInfo = createKeyInfo();

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java?rev=1770741&r1=1770740&r2=1770741&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
Mon Nov 21 19:23:52 2016
@@ -103,8 +103,6 @@ public class WSSecEncrypt extends WSSecE
 
     private List<Element> attachmentEncryptedDataElements;
     
-    private WSSecHeader securityHeader;
-
     public WSSecEncrypt() {
         super();
     }
@@ -211,7 +209,6 @@ public class WSSecEncrypt extends WSSecE
     public Document build(Document doc, Crypto crypto, WSSecHeader secHeader)
         throws WSSecurityException {
         doDebug = LOG.isDebugEnabled();
-        securityHeader = secHeader;
 
         prepare(doc, crypto);
         
@@ -235,7 +232,7 @@ public class WSSecEncrypt extends WSSecE
             LOG.debug("Beginning Encryption...");
         }
         
-        Element refs = encryptForRef(null, parts);
+        Element refs = encryptForRef(null, parts, secHeader);
 
         addAttachmentEncryptedDataElements(secHeader);
         if (encryptedKeyElement != null) {
@@ -254,6 +251,13 @@ public class WSSecEncrypt extends WSSecE
         return doc;
     }
     
+    public Element encryptForRef(
+        Element dataRef,
+        List<WSEncryptionPart> references
+    ) throws WSSecurityException {
+        return encryptForRef(dataRef, references, null);
+    }
+
     /**
      * Encrypt one or more parts or elements of the message.
      * 
@@ -272,12 +276,14 @@ public class WSSecEncrypt extends WSSecE
      * 
      * @param dataRef A <code>xenc:Reference</code> element or <code>null</code>
      * @param references A list containing WSEncryptionPart objects
+     * @param secHeader The WSSecHeader instance
      * @return Returns the updated <code>xenc:Reference</code> element
      * @throws WSSecurityException
      */
     public Element encryptForRef(
-        Element dataRef, 
-        List<WSEncryptionPart> references
+        Element dataRef,
+        List<WSEncryptionPart> references,
+        WSSecHeader secHeader
     ) throws WSSecurityException {
 
         KeyInfo keyInfo = createKeyInfo();



Mime
View raw message