Author: dkulp
Date: Fri May 4 17:56:42 2012
New Revision: 1334097
URL: http://svn.apache.org/viewvc?rev=1334097&view=rev
Log:
Merged revisions 1332185 via svn merge from
https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes
........
r1332185 | coheigea | 2012-04-30 09:19:16 -0400 (Mon, 30 Apr 2012) | 1 line
[CXF-4277] - STSClient does not use returned KeyInfo size when creating a
secret key
........
Modified:
cxf/branches/2.3.x-fixes/ (props changed)
cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Propchange: cxf/branches/2.3.x-fixes/
('svn:mergeinfo' removed)
Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.3.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.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1334097&r1=1334096&r2=1334097&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++
cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Fri May 4 17:56:42 2012
@@ -921,6 +921,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();
@@ -939,6 +940,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);
@@ -984,9 +987,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);