[WSS4J] wss4j/src/org/apache/ws/security WSSecurityEngine.java,1.31,1.32

[email protected] Fri, 16 Jan 2004 07:24:04 -0800
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Update of /cvsroot/wss4j/wss4j/src/org/apache/ws/security
In directory sc8-pr-cvs1:/tmp/cvs-serv26235/src/org/apache/ws/security

Modified Files:
	WSSecurityEngine.java 
Log Message:
Add support for STR-Transform, add new STR Reference type for
encryption

Index: WSSecurityEngine.java
===================================================================
RCS file: /cvsroot/wss4j/wss4j/src/org/apache/ws/security/WSSecurityEngine.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** WSSecurityEngine.java	14 Jan 2004 13:15:54 -0000	1.31
--- WSSecurityEngine.java	16 Jan 2004 15:24:02 -0000	1.32
***************
*** 801,809 ****
              }
              X509Certificate cert = ((X509Security) token).getX509Certificate(crypto);
-             X509Certificate[] certs = new X509Certificate[1];
-             certs[0] = cert;
              if (cert == null) {
                  throw new WSSecurityException(WSSecurityException.FAILURE,
! 					"invalidX509Data", new Object[]{"for decryption"});
              }
              /*
--- 801,807 ----
              }
              X509Certificate cert = ((X509Security) token).getX509Certificate(crypto);
              if (cert == null) {
                  throw new WSSecurityException(WSSecurityException.FAILURE,
! 					"invalidX509Data", new Object[]{"for decryption (KeyId)"});
              }
              /*
***************
*** 815,823 ****
  				log.debug("KeyIdentifier Alias: " + alias);
              }
!         } else {
  			throw new WSSecurityException(
  				WSSecurityException.FAILURE,
  				"unsupportedKeyId");
!         }
  
          /*
--- 813,860 ----
  				log.debug("KeyIdentifier Alias: " + alias);
              }
! 		} else if (secRef.containsReference()) {
! 			Element bstElement = getTokenElement(secRef);
! 
! 			// at this point ... check token type: Binary
! 			QName el =
! 				new QName(
! 					bstElement.getNamespaceURI(),
! 					bstElement.getLocalName());
! 			if (el.equals(BINARY_TOKEN)) {
! 				X509Security token = null;
! 				String value = bstElement.getAttribute("ValueType");
! 				if (!value.equals("wsse:X509v3")
! 					|| ((token = new X509Security(bstElement)) == null)) {
! 					throw new WSSecurityException(
! 						WSSecurityException.UNSUPPORTED_SECURITY_TOKEN,
! 						"unsupportedBinaryTokenType",
! 						new Object[] { "for decryption (BST)" });
! 				}
! 				X509Certificate cert = token.getX509Certificate(crypto);
! 				if (cert == null) {
! 					throw new WSSecurityException(
! 						WSSecurityException.FAILURE,
! 						"invalidX509Data",
! 						new Object[] { "for decryption" });
! 				}
! 				/*
! 				 * Here we have the certificate. Now find the alias for it. Needed to identify
! 				 * the private key associated with this certificate
! 				 */
! 				alias = crypto.getAliasForX509Cert(cert);
! 				if (doDebug) {
! 					log.debug("BST Alias: " + alias);
! 				}
! 			} else {
! 				throw new WSSecurityException(
! 					WSSecurityException.INVALID_SECURITY,
! 					"unsupportedToken",
! 					null);
! 			}
! 		} else {
  			throw new WSSecurityException(
  				WSSecurityException.FAILURE,
  				"unsupportedKeyId");
! 		}
  
          /*




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn