You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ru...@apache.org on 2006/11/20 23:41:28 UTC
svn commit: r477378 - in /webservices/wss4j/trunk/src/org/apache/ws/security:
WSSecurityEngineResult.java processor/EncryptedKeyProcessor.java
processor/ReferenceListProcessor.java
Author: ruchithf
Date: Mon Nov 20 14:41:27 2006
New Revision: 477378
URL: http://svn.apache.org/viewvc?view=rev&rev=477378
Log:
Store the processed DataRef id values in the security results
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java?view=diff&rev=477378&r1=477377&r2=477378
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java Mon Nov 20 14:41:27 2006
@@ -25,6 +25,7 @@
import java.security.Principal;
import java.security.cert.X509Certificate;
+import java.util.ArrayList;
import java.util.Set;
/**
@@ -43,6 +44,7 @@
private SignatureConfirmation sigConf = null;
private byte[] decryptedKey = null;
private String encryptedKeyId = null;
+ private ArrayList dataRefUris = null;
public WSSecurityEngineResult(int act, SAMLAssertion ass) {
principal = null;
@@ -61,11 +63,18 @@
}
public WSSecurityEngineResult(int act, byte[] decryptedKey,
- String encyptedKeyId) {
+ String encyptedKeyId, ArrayList dataRefUris) {
action = act;
this.decryptedKey = decryptedKey;
this.encryptedKeyId = encyptedKeyId;
+ this.dataRefUris = dataRefUris;
}
+
+ public WSSecurityEngineResult(int act, ArrayList dataRefUris) {
+ action = act;
+ this.dataRefUris = dataRefUris;
+ }
+
public WSSecurityEngineResult(int act, Timestamp tstamp) {
action = act;
timestamp = tstamp;
@@ -156,6 +165,10 @@
public String getEncryptedKeyId() {
return encryptedKeyId;
+ }
+
+ public ArrayList getDataRefUris() {
+ return dataRefUris;
}
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java?view=diff&rev=477378&r1=477377&r2=477378
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java Mon Nov 20 14:41:27 2006
@@ -49,6 +49,7 @@
import java.io.IOException;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
+import java.util.ArrayList;
import java.util.Vector;
public class EncryptedKeyProcessor implements Processor {
@@ -73,25 +74,26 @@
throw new WSSecurityException(WSSecurityException.FAILURE,
"noCallback");
}
- handleEncryptedKey((Element) elem, cb, decCrypto);
+ ArrayList dataRefUris = handleEncryptedKey((Element) elem, cb, decCrypto);
encryptedKeyId = elem.getAttributeNS(null, "Id");
returnResults.add(0, new WSSecurityEngineResult(WSConstants.ENCR,
this.decryptedBytes,
- this.encryptedKeyId));
+ this.encryptedKeyId,
+ dataRefUris));
}
- public void handleEncryptedKey(Element xencEncryptedKey,
+ public ArrayList handleEncryptedKey(Element xencEncryptedKey,
CallbackHandler cb, Crypto crypto) throws WSSecurityException {
- handleEncryptedKey(xencEncryptedKey, cb, crypto, null);
+ return handleEncryptedKey(xencEncryptedKey, cb, crypto, null);
}
- public void handleEncryptedKey(Element xencEncryptedKey,
+ public ArrayList handleEncryptedKey(Element xencEncryptedKey,
PrivateKey privatekey) throws WSSecurityException {
- handleEncryptedKey(xencEncryptedKey, null, null, privatekey);
+ return handleEncryptedKey(xencEncryptedKey, null, null, privatekey);
}
- public void handleEncryptedKey(Element xencEncryptedKey,
+ public ArrayList handleEncryptedKey(Element xencEncryptedKey,
CallbackHandler cb, Crypto crypto, PrivateKey privateKey)
throws WSSecurityException {
long t0 = 0, t1 = 0, t2 = 0;
@@ -316,6 +318,7 @@
String dataRefURI = null;
Element refList = (Element) WSSecurityUtil.getDirectChild((Node) xencEncryptedKey,
"ReferenceList", WSConstants.ENC_NS);
+ ArrayList dataRefUris = new ArrayList();
if (refList != null) {
for (tmpE = refList.getFirstChild();
tmpE != null; tmpE = tmpE.getNextSibling()) {
@@ -328,8 +331,10 @@
if (tmpE.getLocalName().equals("DataReference")) {
dataRefURI = ((Element) tmpE).getAttribute("URI");
decryptDataRef(doc, dataRefURI, decryptedBytes);
+ dataRefUris.add(dataRefURI.substring(1));
}
}
+ return dataRefUris;
}
if (tlog.isDebugEnabled()) {
@@ -338,7 +343,8 @@
", get-sym-key= " + (t1 - t0) +
", decrypt= " + (t2 - t1));
}
- return;
+
+ return null;
}
/**
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java?view=diff&rev=477378&r1=477377&r2=477378
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java Mon Nov 20 14:41:27 2006
@@ -17,6 +17,7 @@
package org.apache.ws.security.processor;
+import java.util.ArrayList;
import java.util.Vector;
import javax.crypto.SecretKey;
@@ -63,9 +64,8 @@
}
wssConfig = wsc;
wsDocInfo = wdi;
- handleReferenceList((Element) elem, cb);
- returnResults.add(0, new WSSecurityEngineResult(WSConstants.ENCR, null,
- null));
+ ArrayList uris = handleReferenceList((Element) elem, cb);
+ returnResults.add(0, new WSSecurityEngineResult(WSConstants.ENCR, uris));
}
/**
@@ -78,12 +78,13 @@
* the callback handler to get the key for a key name stored if
* <code>KeyInfo</code> inside the encrypted data elements
*/
- private void handleReferenceList(Element elem, CallbackHandler cb)
+ private ArrayList handleReferenceList(Element elem, CallbackHandler cb)
throws WSSecurityException {
Document doc = elem.getOwnerDocument();
Node tmpE = null;
+ ArrayList dataRefUris = new ArrayList();
for (tmpE = elem.getFirstChild(); tmpE != null; tmpE = tmpE
.getNextSibling()) {
if (tmpE.getNodeType() != Node.ELEMENT_NODE) {
@@ -95,8 +96,10 @@
if (tmpE.getLocalName().equals("DataReference")) {
String dataRefURI = ((Element) tmpE).getAttribute("URI");
decryptDataRefEmbedded(doc, dataRefURI, cb);
+ dataRefUris.add(dataRefURI.substring(1));
}
}
+ return dataRefUris;
}
public void decryptDataRefEmbedded(Document doc, String dataRefURI,
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org