cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r826725 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Date Mon, 19 Oct 2009 17:18:34 GMT
Author: dkulp
Date: Mon Oct 19 17:18:34 2009
New Revision: 826725

URL: http://svn.apache.org/viewvc?rev=826725&view=rev
Log:
Handle case where algorithmSuite isn't set.  Use defaults.

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=826725&r1=826724&r2=826725&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Mon Oct 19 17:18:34 2009
@@ -373,8 +373,12 @@
                 writer.writeStartElement("wst", "Entropy", namespace);
                 writer.writeStartElement("wst", "BinarySecret", namespace);
                 writer.writeAttribute("Type", namespace + "/Nonce");
-                requestorEntropy = WSSecurityUtil
-                    .generateNonce(algorithmSuite.getMaximumSymmetricKeyLength() / 8);
+                if (algorithmSuite == null) {
+                    requestorEntropy = WSSecurityUtil.generateNonce(8);
+                } else {
+                    requestorEntropy = WSSecurityUtil
+                        .generateNonce(algorithmSuite.getMaximumSymmetricKeyLength() / 8);
+                } 
                 writer.writeCharacters(Base64.encode(requestorEntropy));
 
                 writer.writeEndElement();
@@ -724,7 +728,10 @@
                     // Right now we only use PSHA1 as the computed key algo
                     P_SHA1 psha1 = new P_SHA1();
 
-                    int length = (keySize > 0) ? keySize : algorithmSuite.getMaximumSymmetricKeyLength();
+                    int length = (keySize > 0) ? keySize : 256;
+                    if (algorithmSuite != null) {
+                        length = (keySize > 0) ? keySize : algorithmSuite.getMaximumSymmetricKeyLength();
+                    }
                     try {
                         secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length
/ 8);
                     } catch (ConversationException e) {



Mime
View raw message