cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1332181 - /cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Date Mon, 30 Apr 2012 13:09:00 GMT
Author: coheigea
Date: Mon Apr 30 13:09:00 2012
New Revision: 1332181

URL: http://svn.apache.org/viewvc?rev=1332181&view=rev
Log:
[CXF-4277] - STSClient does not use returned KeyInfo size when creating a secret key

Modified:
    cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1332181&r1=1332180&r2=1332181&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Mon Apr 30 13:09:00 2012
@@ -1175,6 +1175,7 @@ public class STSClient implements Config
         Element lte = null;
         Element entropy = null;
         String tt = null;
+        String retKeySize = null;
 
         while (el != null) {
             String ln = el.getLocalName();
@@ -1193,6 +1194,8 @@ public class STSClient implements Config
                     entropy = el;
                 } else if ("TokenType".equals(ln)) {
                     tt = DOMUtils.getContent(el);
+                } else if ("KeySize".equals(ln)) {
+                    retKeySize = DOMUtils.getContent(el);
                 }
             }
             el = DOMUtils.getNextElement(el);
@@ -1238,9 +1241,18 @@ public class STSClient implements Config
                     // Right now we only use PSHA1 as the computed key algo
                     P_SHA1 psha1 = new P_SHA1();
 
-                    int length = (keySize > 0) ? keySize : 256;
-                    if (algorithmSuite != null) {
-                        length = (keySize > 0) ? keySize : algorithmSuite.getMaximumSymmetricKeyLength();
+                    int length = 0;
+                    if (retKeySize != null) {
+                        try {
+                            length = Integer.parseInt(retKeySize);
+                        } catch (NumberFormatException ex) {
+                            // do nothing
+                        }
+                    } else {
+                        length = keySize;
+                    }
+                    if (length <= 0) {
+                        length = 256;
                     }
                     try {
                         secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length
/ 8);



Mime
View raw message