From kelly04@example.net Wed Oct 01 10:30:37 2008 Return-Path: <kelly04@example.net> Delivered-To: kelly04@example.net Received: (qmail 70482 invoked from network); 1 Oct 2008 10:30:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Oct 2008 10:30:37 -0000 Received: (qmail 19041 invoked by uid 500); 1 Oct 2008 10:30:35 -0000 Delivered-To: kelly04@example.net Received: (qmail 18866 invoked by uid 500); 1 Oct 2008 10:30:33 -0000 Mailing-List: contact kelly04@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:kelly04@example.net> List-Unsubscribe: <mailto:kelly04@example.net> List-Post: <mailto:kelly04@example.net> List-Id: <wss4j-dev.ws.apache.org> Delivered-To: mailing list kelly04@example.net Received: (qmail 18850 invoked by uid 99); 1 Oct 2008 10:30:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 03:30:33 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 10:29:39 +0000 Received: from brutus (localhost [83.161.120.155]) by brutus.apache.org (Postfix) with ESMTP id 34A06234C1FA for <kelly04@example.net>; Wed, 1 Oct 2008 03:29:44 -0700 (PDT) Message-ID: <97614586.1222856984214.JavaMail.jira@brutus> Date: Wed, 1 Oct 2008 03:29:44 -0700 (PDT) From: "Colm O hEigeartaigh (JIRA)" <kelly04@example.net> To: kelly04@example.net Subject: [jira] Assigned: (WSS-124) Get maven dependencies pushed to central In-Reply-To: <1000224887.1212586185991.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/WSS-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Colm O hEigeartaigh reassigned WSS-124: --------------------------------------- Assignee: Colm O hEigeartaigh (was: Fred Dushin) > Get maven dependencies pushed to central > ---------------------------------------- > > Key: WSS-124 > URL: https://issues.apache.org/jira/browse/WSS-124 > Project: WSS4J > Issue Type: Task > Components: WSS4J Core > Affects Versions: 1.5.4 > Reporter: Daniel Kulp > Assignee: Colm O hEigeartaigh > Fix For: 1.5.5 > > > Having a pom for wss4j is great, but the repository entry really need to be removed and the dependencies that are in the ws repository need to be pushed to central (and also have poms for them). For things like opensaml, you can follow the guide at: > http://maven.apache.org/guides/mini/guide-central-repository-upload.html > For xmlsec, you will need to work with the xmlsec folks to get someone on that group to properly sign the artifacts and get them into the sync repository on people.apache.org. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: kelly04@example.net For additional commands, e-mail: kelly04@example.net From kelly04@example.net Wed Oct 01 11:06:27 2008 Return-Path: <kelly04@example.net> Delivered-To: kelly04@example.net Received: (qmail 89214 invoked from network); 1 Oct 2008 11:06:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Oct 2008 11:06:27 -0000 Received: (qmail 53502 invoked by uid 500); 1 Oct 2008 11:06:25 -0000 Delivered-To: kelly04@example.net Received: (qmail 53452 invoked by uid 500); 1 Oct 2008 11:06:25 -0000 Mailing-List: contact kelly04@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:kelly04@example.net> List-Unsubscribe: <mailto:kelly04@example.net> List-Post: <mailto:kelly04@example.net> List-Id: <wss4j-dev.ws.apache.org> Delivered-To: mailing list kelly04@example.net Received: (qmail 53441 invoked by uid 500); 1 Oct 2008 11:06:25 -0000 Delivered-To: kelly04@example.net Received: (qmail 53438 invoked by uid 99); 1 Oct 2008 11:06:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 04:06:25 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 11:05:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6753B2388A04; Wed, 1 Oct 2008 04:05:54 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r700739 - in /webservices/wss4j/trunk: pom.xml src/org/apache/ws/security/WSSecurityEngine.java src/org/apache/ws/security/processor/SignatureProcessor.java Date: Wed, 01 Oct 2008 11:05:53 -0000 To: kelly04@example.net From: kelly04@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <kelly04@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: coheigea Date: Wed Oct 1 04:05:53 2008 New Revision: 700739 URL: http://svn.apache.org/viewvc?rev=700739&view=rev Log: [WSS-124] - pom cleanup - Removed unused ciManagement blob - Updated versions of the build plugins - Removed commented out sections of build plugins - Removed maven central and snapshot from "repositories" - Removed pluginRepositories blob altogether (no more codehaus dependencies) - Switched codehaus jdepend-maven-plugin to maven-dependency-plugin - Switched codehaus jxr-maven-plugin to maven-jxr-plugin Modified: webservices/wss4j/trunk/pom.xml webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java Modified: webservices/wss4j/trunk/pom.xml URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/pom.xml?rev=700739&r1=700738&r2=700739&view=diff ============================================================================== --- webservices/wss4j/trunk/pom.xml (original) +++ webservices/wss4j/trunk/pom.xml Wed Oct 1 04:05:53 2008 @@ -22,21 +22,6 @@ <system>JIRA</system> <url>http://issues.apache.org/jira/browse/WSS</url> </issueManagement> - <ciManagement> - <system>Continuum</system> - <url>unknown</url> - <notifiers> - <notifier> - <sendOnError>false</sendOnError> - <sendOnFailure>false</sendOnFailure> - <sendOnSuccess>false</sendOnSuccess> - <sendOnWarning>false</sendOnWarning> - <configuration> - <address>kelly04@example.net</address> - </configuration> - </notifier> - </notifiers> - </ciManagement> <mailingLists> <mailingList> <name>WSS4J Developer List</name> @@ -93,7 +78,6 @@ <organization></organization> </developer> </developers> - <licenses> <license> <name>The Apache Software License, Version 2.0</name> @@ -114,6 +98,7 @@ <name>Apache Software Foundation</name> <url>http://www.apache.org/</url> </organization> + <build> <sourceDirectory>src</sourceDirectory> <resources> @@ -126,11 +111,11 @@ </resource> </resources> - <!--<testSourceDirectory>test</testSourceDirectory> --> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> - <version>1.1</version> + <version>1.2</version> <executions> <execution> <id>prepareLicenseFiles</id> @@ -150,47 +135,12 @@ <goal>run</goal> </goals> </execution> - <!-- <execution> - <id>settingUpInteropTests</id> - <phase>generate-resources</phase> - <configuration> - <tasks> - - <mkdir dir="target/work"/> - <axis-wsdl2java - output="target/work" - serverSide="yes" - testcase="no" - verbose="no" - url="interop/ping.wsdl"> - <mapping - namespace="http://xmlsoap.org/Ping" - package="org.apache.ws.axis.oasis.ping"/> - </axis-wsdl2java> - - <echo message="Starting http server."/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <id>stopServer</id> - <phase>install</phase> - <configuration> - <tasks> - <echo message="Stopping http server."/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> --> </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-one-plugin</artifactId> + <version>1.2</version> <executions> <execution> <goals> @@ -207,6 +157,7 @@ </configuration> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <configuration> <tagBase> @@ -215,27 +166,18 @@ </configuration> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> <configuration> <source>1.3</source> <target>1.3</target> </configuration> </plugin> - - <!--<plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>**/*Test.java</include> - </includes> - <excludes> - <exclude>tests/w3c/SchemaTest.java</exclude> - </excludes> - </configuration> - </plugin> --> - <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> + <version>2.1</version> <configuration> <descriptors> <descriptor>assembly/bin.xml</descriptor> @@ -245,7 +187,9 @@ </configuration> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> + <version>2.0.4</version> <executions> <execution> <goals> @@ -259,6 +203,7 @@ </plugin> </plugins> </build> + <profiles> <profile> <id>release</id> @@ -271,7 +216,9 @@ <build> <plugins> <plugin> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.5</version> <executions> <execution> <goals> @@ -300,7 +247,6 @@ </dependency> </dependencies> </profile> - <profile> <id>jdk15</id> <activation> @@ -314,8 +260,8 @@ </dependency> </dependencies> </profile> - </profiles> + <properties> <xmlsec.version>1.4.0</xmlsec.version> <opensaml.version>1.1</opensaml.version> @@ -328,27 +274,10 @@ <axis.version>1.4</axis.version> <junit.version>3.8.1</junit.version> </properties> + <repositories> <repository> <releases> - <enabled>false</enabled> - <updatePolicy>always</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </releases> - <snapshots> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - <checksumPolicy>fail</checksumPolicy> - </snapshots> - <id>apache-snapshots</id> - <name>Apache Maven2 SNAPSHOTS</name> - <url> - http://people.apache.org/repo/m2-snapshot-repository/ - </url> - <layout>default</layout> - </repository> - <repository> - <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy> @@ -358,52 +287,12 @@ <updatePolicy>never</updatePolicy> <checksumPolicy>warn</checksumPolicy> </snapshots> - <id>maven2</id> - <name>Maven2 repo</name> - <url>http://repo1.maven.org/maven2/</url> - </repository> - <repository> - <releases> - <enabled>true</enabled> - <updatePolicy>always</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </releases> - <snapshots> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </snapshots> <id>apache-ws-snapshots2</id> <name>Apache ws.zones - 2</name> <url>http://ws.zones.apache.org/repository2/</url> </repository> </repositories> - <pluginRepositories> - <pluginRepository> - <id>snapshot</id> - <name>Snapshot repository</name> - <url>http://snapshots.maven.codehaus.org/maven2/</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - <releases> - <enabled>false</enabled> - </releases> - </pluginRepository> - <pluginRepository> - <id>snapshot-apache</id> - <name>Apache Snapshot repository</name> - <url> - http://people.apache.org/repo/m2-snapshot-repository - </url> - <snapshots> - <enabled>true</enabled> - </snapshots> - <releases> - <enabled>false</enabled> - </releases> - </pluginRepository> - </pluginRepositories> + <dependencies> <dependency> <groupId>commons-logging</groupId> @@ -455,55 +344,59 @@ <reporting> <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.1</version> + <reportSets> + <reportSet> + <reports> + <report>dependencies</report> + <report>issue-tracking</report> + <report>license</report> + <report>mailing-list</report> + <report>project-team</report> + <report>scm</report> + </reports> + </reportSet> + </reportSets> + </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> + <version>2.5</version> </plugin> <plugin> - <artifactId> - maven-project-info-reports-plugin - </artifactId> - <reportSets> - <reportSet> - <reports> - <report>dependencies</report> - <report>project-team</report> - <report>mailing-list</report> - <report>issue-tracking</report> - <report>license</report> - <report>scm</report> - </reports> - </reportSet> - </reportSets> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jdepend-maven-plugin</artifactId> - <version>2.0-beta-1-SNAPSHOT</version> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jxr-maven-plugin</artifactId> - <version>2.0-beta-1</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-changes-plugin</artifactId> - <configuration> - <onlyCurrentVersion>true</onlyCurrentVersion> - <resolutionIds>Any</resolutionIds> - <statusIds>Resolved, Closed</statusIds> - <sortColumnNames>Key</sortColumnNames> - </configuration> - <reportSets> - <reportSet> - <reports> - <report>jira-report</report> - </reports> - </reportSet> - </reportSets> - </plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changes-plugin</artifactId> + <version>2.0</version> + <configuration> + <onlyCurrentVersion>true</onlyCurrentVersion> + <resolutionIds>Any</resolutionIds> + <statusIds>Resolved, Closed</statusIds> + <sortColumnNames>Key</sortColumnNames> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>jira-report</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.0</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + <version>2.1</version> + </plugin> </plugins> </reporting> + <distributionManagement> <repository> <id>apache-repo</id> @@ -512,13 +405,6 @@ scpexe://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository </url> </repository> - <snapshotRepository> - <id>apache-snapshots</id> - <name>Apache Development Repository</name> - <url> - scpexe://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository - </url> - </snapshotRepository> <site> <id>website</id> <url> Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java?rev=700739&r1=700738&r2=700739&view=diff ============================================================================== --- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java (original) +++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java Wed Oct 1 04:05:53 2008 @@ -157,8 +157,8 @@ /** * Process the security header given the soap envelope as W3C document. * <p/> - * This is the main entry point to verify or decrypt a SOAP enevelope. - * First check if a <code>wsse:Security</code> is availabe with the + * This is the main entry point to verify or decrypt a SOAP envelope. + * First check if a <code>wsse:Security</code> is available with the * defined actor. * * @param doc the SOAP envelope as {@link Document} @@ -184,7 +184,7 @@ /** * Process the security header given the soap envelope as W3C document. * <p/> - * This is the main entry point to verify or decrypt a SOAP enevelope. + * This is the main entry point to verify or decrypt a SOAP envelope. * First check if a <code>wsse:Security</code> is available with the * defined actor. * @@ -200,7 +200,8 @@ * handling of certificates for Decryption * @return a result vector * @throws WSSecurityException - * @see WSSecurityEngine#processSecurityHeader(Element securityHeader, CallbackHandler cb,Crypto sigCrypto, Crypto decCrypto) + * @see WSSecurityEngine#processSecurityHeader( + * Element securityHeader, CallbackHandler cb,Crypto sigCrypto, Crypto decCrypto) */ public Vector processSecurityHeader(Document doc, String actor, @@ -235,7 +236,7 @@ * Element. * * This function loops over all direct child elements of the - * <code>wsse:Security</code> header. If it finds a knwon element, it + * <code>wsse:Security</code> header. If it finds a known element, it * transfers control to the appropriate handling function. The method * processes the known child elements in the same order as they appear in * the <code>wsse:Security</code> element. This is in accordance to the WS @@ -280,7 +281,7 @@ } /* * Gather some info about the document to process and store - * it for retrival. Store the implemenation of signature crypto + * it for retrieval. Store the implementation of signature crypto * (no need for encryption --- yet) */ WSDocInfo wsDocInfo = new WSDocInfo(securityHeader.getOwnerDocument().hashCode()); @@ -304,7 +305,7 @@ Processor p = cfg.getProcessor(el); /* * Call the processor for this token. After the processor returns, - * store it for later retrival. The token processor may store some + * store it for later retrieval. The token processor may store some * information about the processed token */ if (p != null) { Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java?rev=700739&r1=700738&r2=700739&view=diff ============================================================================== --- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java (original) +++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java Wed Oct 1 04:05:53 2008 @@ -124,7 +124,8 @@ * </ul> * <p/> * The methods checks is the certificate is valid and calls the - * {@link org.apache.xml.security.signature.XMLSignature#checkSignatureValue(X509Certificate) verfication} function. + * {@link org.apache.xml.security.signature.XMLSignature#checkSignatureValue(X509Certificate) + * verification} function. * * @param elem the XMLSignature DOM Element. * @param crypto the object that implements the access to the keystore and the --------------------------------------------------------------------- To unsubscribe, e-mail: kelly04@example.net For additional commands, e-mail: kelly04@example.net From kelly04@example.net Wed Oct 01 11:22:38 2008 Return-Path: <kelly04@example.net> Delivered-To: kelly04@example.net Received: (qmail 93769 invoked from network); 1 Oct 2008 11:22:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Oct 2008 11:22:38 -0000 Received: (qmail 68936 invoked by uid 500); 1 Oct 2008 11:22:36 -0000 Delivered-To: kelly04@example.net Received: (qmail 68668 invoked by uid 500); 1 Oct 2008 11:22:36 -0000 Mailing-List: contact kelly04@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:kelly04@example.net> List-Unsubscribe: <mailto:kelly04@example.net> List-Post: <mailto:kelly04@example.net> List-Id: <wss4j-dev.ws.apache.org> Delivered-To: mailing list kelly04@example.net Received: (qmail 68652 invoked by uid 99); 1 Oct 2008 11:22:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 04:22:35 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 11:21:42 +0000 Received: from brutus (localhost [83.161.120.155]) by brutus.apache.org (Postfix) with ESMTP id 8AF47234C1F9 for <kelly04@example.net>; Wed, 1 Oct 2008 04:21:46 -0700 (PDT) Message-ID: <1212346031.1222860106568.JavaMail.jira@brutus> Date: Wed, 1 Oct 2008 04:21:46 -0700 (PDT) From: "Colm O hEigeartaigh (JIRA)" <kelly04@example.net> To: kelly04@example.net Subject: [jira] Created: (WSS-144) Remove tab characters from WSS4J files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Remove tab characters from WSS4J files -------------------------------------- Key: WSS-144 URL: https://issues.apache.org/jira/browse/WSS-144 Project: WSS4J Issue Type: Task Affects Versions: 1.5.4 Reporter: Colm O hEigeartaigh Assignee: Colm O hEigeartaigh Priority: Minor Fix For: 1.5.5 Remove tab characters from WSS4J files. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: kelly04@example.net For additional commands, e-mail: kelly04@example.net From kelly04@example.net Wed Oct 01 13:56:38 2008 Return-Path: <kelly04@example.net> Delivered-To: kelly04@example.net Received: (qmail 3536 invoked from network); 1 Oct 2008 13:56:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Oct 2008 13:56:38 -0000 Received: (qmail 21869 invoked by uid 500); 1 Oct 2008 13:56:36 -0000 Delivered-To: kelly04@example.net Received: (qmail 21637 invoked by uid 500); 1 Oct 2008 13:56:35 -0000 Mailing-List: contact kelly04@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:kelly04@example.net> List-Unsubscribe: <mailto:kelly04@example.net> List-Post: <mailto:kelly04@example.net> List-Id: <wss4j-dev.ws.apache.org> Delivered-To: mailing list kelly04@example.net Received: (qmail 21626 invoked by uid 500); 1 Oct 2008 13:56:35 -0000 Delivered-To: kelly04@example.net Received: (qmail 21623 invoked by uid 99); 1 Oct 2008 13:56:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 06:56:35 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 13:55:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C18FE2388A04; Wed, 1 Oct 2008 06:56:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r700768 [2/4] - in /webservices/wss4j/trunk: ./ interop/org/apache/ws/axis/oasis/ src/org/apache/ws/axis/security/ src/org/apache/ws/axis/security/handler/ src/org/apache/ws/security/ src/org/apache/ws/security/action/ src/org/apache/ws/sec... Date: Wed, 01 Oct 2008 13:56:11 -0000 To: kelly04@example.net From: kelly04@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <kelly04@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?rev=700768&r1=700767&r2=700768&view=diff ============================================================================== --- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original) +++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Wed Oct 1 06:56:10 2008 @@ -74,44 +74,44 @@ */ public class WSSecSignature extends WSSecBase { - private static Log log = LogFactory.getLog(WSSecSignature.class.getName()); + private static Log log = LogFactory.getLog(WSSecSignature.class.getName()); - protected boolean useSingleCert = true; + protected boolean useSingleCert = true; - protected String sigAlgo = null; + protected String sigAlgo = null; - protected String canonAlgo = Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS; + protected String canonAlgo = Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS; - protected WSSecUsernameToken usernameToken = null; + protected WSSecUsernameToken usernameToken = null; - protected byte[] signatureValue = null; + protected byte[] signatureValue = null; - /* - * The following private variable are setup during prepare(). - */ - protected Document document = null; + /* + * The following private variable are setup during prepare(). + */ + protected Document document = null; - private Crypto crypto = null; + private Crypto crypto = null; - protected WSDocInfo wsDocInfo = null; + protected WSDocInfo wsDocInfo = null; - protected String certUri = null; + protected String certUri = null; - protected XMLSignature sig = null; + protected XMLSignature sig = null; - protected KeyInfo keyInfo = null; + protected KeyInfo keyInfo = null; - protected String keyInfoUri = null; + protected String keyInfoUri = null; - protected SecurityTokenReference secRef = null; + protected SecurityTokenReference secRef = null; - protected String strUri = null; + protected String strUri = null; - private byte[] secretKey = null; - - private String encrKeySha1value = null; + private byte[] secretKey = null; + + private String encrKeySha1value = null; - protected BinarySecurity bstToken = null; + protected BinarySecurity bstToken = null; private String customTokenValueType; @@ -119,88 +119,88 @@ private String digestAlgo = "http://www.w3.org/2000/09/xmldsig#sha1"; - /** - * Constructor. - */ - public WSSecSignature() { - } - - /** - * set the single cert flag. - * - * @param useSingleCert - */ - public void setUseSingleCertificate(boolean useSingleCert) { - this.useSingleCert = useSingleCert; - } - - /** - * Get the single cert flag. - * - * @return A boolean if single certificate is set. - */ - public boolean isUseSingleCertificate() { - return this.useSingleCert; - } - - /** - * Set the name of the signature encryption algorithm to use. - * - * If the algorithm is not set then an automatic detection of the signature - * algorithm to use is performed during the <code>prepare()</code> - * method. Refer to WSConstants which algorithms are supported. - * - * @param algo - * Is the name of the signature algorithm - * @see WSConstants#RSA - * @see WSConstants#DSA - */ - public void setSignatureAlgorithm(String algo) { - sigAlgo = algo; - } - - /** - * Get the name of the signature algorithm that is being used. - * - * Call this method after <code>prepare</code> to get the information - * which signature algorithm was automatically detected if no signature - * algorithm was preset. - * - * @return the identifier URI of the signature algorithm - */ - public String getSignatureAlgorithm() { - return sigAlgo; - } - - /** - * Set the canonicalization method to use. - * - * If the canonicalization method is not set then the recommended Exclusive - * XML Canonicalization is used by default Refer to WSConstants which - * algorithms are supported. - * - * @param algo - * Is the name of the signature algorithm - * @see WSConstants#C14N_OMIT_COMMENTS - * @see WSConstants#C14N_WITH_COMMENTS - * @see WSConstants#C14N_EXCL_OMIT_COMMENTS - * @see WSConstants#C14N_EXCL_WITH_COMMENTS - */ - public void setSigCanonicalization(String algo) { - canonAlgo = algo; - } - - /** - * Get the canonicalization method. - * - * If the canonicalization method was not set then Exclusive XML - * Canonicalization is used by default. - * - * @return The string describing the canonicalization algorithm. - */ - public String getSigCanonicalization() { - return canonAlgo; - } + /** + * Constructor. + */ + public WSSecSignature() { + } + + /** + * set the single cert flag. + * + * @param useSingleCert + */ + public void setUseSingleCertificate(boolean useSingleCert) { + this.useSingleCert = useSingleCert; + } + + /** + * Get the single cert flag. + * + * @return A boolean if single certificate is set. + */ + public boolean isUseSingleCertificate() { + return this.useSingleCert; + } + + /** + * Set the name of the signature encryption algorithm to use. + * + * If the algorithm is not set then an automatic detection of the signature + * algorithm to use is performed during the <code>prepare()</code> + * method. Refer to WSConstants which algorithms are supported. + * + * @param algo + * Is the name of the signature algorithm + * @see WSConstants#RSA + * @see WSConstants#DSA + */ + public void setSignatureAlgorithm(String algo) { + sigAlgo = algo; + } + + /** + * Get the name of the signature algorithm that is being used. + * + * Call this method after <code>prepare</code> to get the information + * which signature algorithm was automatically detected if no signature + * algorithm was preset. + * + * @return the identifier URI of the signature algorithm + */ + public String getSignatureAlgorithm() { + return sigAlgo; + } + + /** + * Set the canonicalization method to use. + * + * If the canonicalization method is not set then the recommended Exclusive + * XML Canonicalization is used by default Refer to WSConstants which + * algorithms are supported. + * + * @param algo + * Is the name of the signature algorithm + * @see WSConstants#C14N_OMIT_COMMENTS + * @see WSConstants#C14N_WITH_COMMENTS + * @see WSConstants#C14N_EXCL_OMIT_COMMENTS + * @see WSConstants#C14N_EXCL_WITH_COMMENTS + */ + public void setSigCanonicalization(String algo) { + canonAlgo = algo; + } + + /** + * Get the canonicalization method. + * + * If the canonicalization method was not set then Exclusive XML + * Canonicalization is used by default. + * + * @return The string describing the canonicalization algorithm. + */ + public String getSigCanonicalization() { + return canonAlgo; + } /** * @return the digestAlgo @@ -218,41 +218,41 @@ this.digestAlgo = digestAlgo; } - - /** - * @param usernameToken - * The usernameToken to set. - */ - public void setUsernameToken(WSSecUsernameToken usernameToken) { - this.usernameToken = usernameToken; - } - - /** - * Returns the computed Signature value. - * - * Call this method after <code>computeSignature()</code> or <code>build()</code> - * methods were called. - * - * @return Returns the signatureValue. - */ - public byte[] getSignatureValue() { - return signatureValue; - } - - /** - * Get the id generated during <code>prepare()</code>. - * - * Returns the the value of wsu:Id attribute of the Signature element. - * - * @return Return the wsu:Id of this token or null if <code>prepare()</code> - * was not called before. - */ - public String getId() { - if (sig == null) { - return null; - } - return sig.getId(); - } + + /** + * @param usernameToken + * The usernameToken to set. + */ + public void setUsernameToken(WSSecUsernameToken usernameToken) { + this.usernameToken = usernameToken; + } + + /** + * Returns the computed Signature value. + * + * Call this method after <code>computeSignature()</code> or <code>build()</code> + * methods were called. + * + * @return Returns the signatureValue. + */ + public byte[] getSignatureValue() { + return signatureValue; + } + + /** + * Get the id generated during <code>prepare()</code>. + * + * Returns the the value of wsu:Id attribute of the Signature element. + * + * @return Return the wsu:Id of this token or null if <code>prepare()</code> + * was not called before. + */ + public String getId() { + if (sig == null) { + return null; + } + return sig.getId(); + } /** * Get the id of the BSt generated during <code>prepare()</code>. @@ -268,358 +268,358 @@ return this.bstToken.getID(); } - /** - * Initialize a WSSec Signature. - * - * The method sets up and initializes a WSSec Signature structure after the - * relevant information was set. After setup of the references to elements - * to sign may be added. After all references are added they can be signed. - * - * <p/> - * - * This method does not add the Signature element to the security header. - * See <code>prependSignatureElementToHeader()</code> method. - * - * @param doc - * The SOAP envelope as <code>Document</code> - * @param cr - * An instance of the Crypto API to handle keystore and - * certificates - * @param secHeader - * The security header that will hold the Signature. This is used - * to construct namespace prefixes for Signature. This method - * @throws WSSecurityException - */ - public void prepare(Document doc, Crypto cr, WSSecHeader secHeader) - throws WSSecurityException { - /* - * Gather some info about the document to process and store it for - * retrieval - */ - crypto = cr; - document = doc; - - wsDocInfo = new WSDocInfo(doc.hashCode()); - wsDocInfo.setCrypto(cr); - - /* - * At first get the security token (certificate) according to the - * parameters. - */ - X509Certificate[] certs = null; - if (keyIdentifierType != WSConstants.UT_SIGNING + /** + * Initialize a WSSec Signature. + * + * The method sets up and initializes a WSSec Signature structure after the + * relevant information was set. After setup of the references to elements + * to sign may be added. After all references are added they can be signed. + * + * <p/> + * + * This method does not add the Signature element to the security header. + * See <code>prependSignatureElementToHeader()</code> method. + * + * @param doc + * The SOAP envelope as <code>Document</code> + * @param cr + * An instance of the Crypto API to handle keystore and + * certificates + * @param secHeader + * The security header that will hold the Signature. This is used + * to construct namespace prefixes for Signature. This method + * @throws WSSecurityException + */ + public void prepare(Document doc, Crypto cr, WSSecHeader secHeader) + throws WSSecurityException { + /* + * Gather some info about the document to process and store it for + * retrieval + */ + crypto = cr; + document = doc; + + wsDocInfo = new WSDocInfo(doc.hashCode()); + wsDocInfo.setCrypto(cr); + + /* + * At first get the security token (certificate) according to the + * parameters. + */ + X509Certificate[] certs = null; + if (keyIdentifierType != WSConstants.UT_SIGNING && keyIdentifierType != WSConstants.CUSTOM_SYMM_SIGNING && keyIdentifierType != WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER) { - certs = crypto.getCertificates(user); - if (certs == null || certs.length <= 0) { - throw new WSSecurityException( - WSSecurityException.FAILURE, - "noUserCertsFound", - new Object[] { user, "signature" } - ); - } - certUri = "CertId-" + certs[0].hashCode(); - /* - * If no signature algo was set try to detect it according to the - * data stored in the certificate. - */ - if (sigAlgo == null) { - String pubKeyAlgo = certs[0].getPublicKey().getAlgorithm(); - log.debug("automatic sig algo detection: " + pubKeyAlgo); - if (pubKeyAlgo.equalsIgnoreCase("DSA")) { - sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA; - } else if (pubKeyAlgo.equalsIgnoreCase("RSA")) { - sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA; - } else { - throw new WSSecurityException( - WSSecurityException.FAILURE, - "unknownSignatureAlgorithm", - new Object[] { - pubKeyAlgo - } - ); - } - } - } - - /* - * Get an initialized XMLSignature element. - */ - if (canonAlgo.equals(WSConstants.C14N_EXCL_OMIT_COMMENTS)) { - Element canonElem = XMLUtils.createElementInSignatureSpace(doc, - Constants._TAG_CANONICALIZATIONMETHOD); - - canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo); - - if (wssConfig.isWsiBSPCompliant()) { - Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false); - - InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces( - doc, prefixes); - - canonElem.appendChild(inclusiveNamespaces.getElement()); - } - - try { - SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm( - doc, sigAlgo); - sig = new XMLSignature(doc, null, signatureAlgorithm - .getElement(), canonElem); - } catch (XMLSecurityException e) { - log.error("", e); - throw new WSSecurityException( - WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e - ); - } - } else { - try { - sig = new XMLSignature(doc, null, sigAlgo, canonAlgo); - } catch (XMLSecurityException e) { - log.error("", e); - throw new WSSecurityException( - WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e - ); - } - } - - sig.addResourceResolver(EnvelopeIdResolver.getInstance()); - String sigUri = "Signature-" + sig.hashCode(); - sig.setId(sigUri); - - keyInfo = sig.getKeyInfo(); - keyInfoUri = "KeyId-" + keyInfo.hashCode(); - keyInfo.setId(keyInfoUri); - - secRef = new SecurityTokenReference(doc); - strUri = "STRId-" + secRef.hashCode(); - secRef.setID(strUri); - - /* - * Prepare and setup the token references for this Signature - */ - switch (keyIdentifierType) { - case WSConstants.BST_DIRECT_REFERENCE: - Reference ref = new Reference(document); - ref.setURI("#" + certUri); - if (!useSingleCert) { - bstToken = new PKIPathSecurity(document); - ((PKIPathSecurity) bstToken).setX509Certificates(certs, false, - crypto); - } else { - bstToken = new X509Security(document); - ((X509Security) bstToken).setX509Certificate(certs[0]); - } - ref.setValueType(bstToken.getValueType()); - secRef.setReference(ref); - bstToken.setID(certUri); - wsDocInfo.setBst(bstToken.getElement()); - break; - - case WSConstants.ISSUER_SERIAL: - XMLX509IssuerSerial data = new XMLX509IssuerSerial(document, - certs[0]); - X509Data x509Data = new X509Data(document); - x509Data.add(data); - secRef.setX509IssuerSerial(x509Data); - break; - - case WSConstants.X509_KEY_IDENTIFIER: - secRef.setKeyIdentifier(certs[0]); - break; - - case WSConstants.SKI_KEY_IDENTIFIER: - secRef.setKeyIdentifierSKI(certs[0], crypto); - break; - - case WSConstants.UT_SIGNING: - Reference refUt = new Reference(document); - refUt.setValueType(WSConstants.USERNAMETOKEN_NS + "#UsernameToken"); - String utId = usernameToken.getId(); - refUt.setURI("#" + utId); - secRef.setReference(refUt); - secretKey = usernameToken.getSecretKey(); - break; - - case WSConstants.THUMBPRINT_IDENTIFIER: - secRef.setKeyIdentifierThumb(certs[0]); - break; - - case WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER: - secRef.setKeyIdentifierEncKeySHA1(this.encrKeySha1value); - break; + certs = crypto.getCertificates(user); + if (certs == null || certs.length <= 0) { + throw new WSSecurityException( + WSSecurityException.FAILURE, + "noUserCertsFound", + new Object[] { user, "signature" } + ); + } + certUri = "CertId-" + certs[0].hashCode(); + /* + * If no signature algo was set try to detect it according to the + * data stored in the certificate. + */ + if (sigAlgo == null) { + String pubKeyAlgo = certs[0].getPublicKey().getAlgorithm(); + log.debug("automatic sig algo detection: " + pubKeyAlgo); + if (pubKeyAlgo.equalsIgnoreCase("DSA")) { + sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA; + } else if (pubKeyAlgo.equalsIgnoreCase("RSA")) { + sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA; + } else { + throw new WSSecurityException( + WSSecurityException.FAILURE, + "unknownSignatureAlgorithm", + new Object[] { + pubKeyAlgo + } + ); + } + } + } + + /* + * Get an initialized XMLSignature element. + */ + if (canonAlgo.equals(WSConstants.C14N_EXCL_OMIT_COMMENTS)) { + Element canonElem = XMLUtils.createElementInSignatureSpace(doc, + Constants._TAG_CANONICALIZATIONMETHOD); + + canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo); + + if (wssConfig.isWsiBSPCompliant()) { + Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false); + + InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces( + doc, prefixes); + + canonElem.appendChild(inclusiveNamespaces.getElement()); + } + + try { + SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm( + doc, sigAlgo); + sig = new XMLSignature(doc, null, signatureAlgorithm + .getElement(), canonElem); + } catch (XMLSecurityException e) { + log.error("", e); + throw new WSSecurityException( + WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e + ); + } + } else { + try { + sig = new XMLSignature(doc, null, sigAlgo, canonAlgo); + } catch (XMLSecurityException e) { + log.error("", e); + throw new WSSecurityException( + WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e + ); + } + } + + sig.addResourceResolver(EnvelopeIdResolver.getInstance()); + String sigUri = "Signature-" + sig.hashCode(); + sig.setId(sigUri); + + keyInfo = sig.getKeyInfo(); + keyInfoUri = "KeyId-" + keyInfo.hashCode(); + keyInfo.setId(keyInfoUri); + + secRef = new SecurityTokenReference(doc); + strUri = "STRId-" + secRef.hashCode(); + secRef.setID(strUri); + + /* + * Prepare and setup the token references for this Signature + */ + switch (keyIdentifierType) { + case WSConstants.BST_DIRECT_REFERENCE: + Reference ref = new Reference(document); + ref.setURI("#" + certUri); + if (!useSingleCert) { + bstToken = new PKIPathSecurity(document); + ((PKIPathSecurity) bstToken).setX509Certificates(certs, false, + crypto); + } else { + bstToken = new X509Security(document); + ((X509Security) bstToken).setX509Certificate(certs[0]); + } + ref.setValueType(bstToken.getValueType()); + secRef.setReference(ref); + bstToken.setID(certUri); + wsDocInfo.setBst(bstToken.getElement()); + break; + + case WSConstants.ISSUER_SERIAL: + XMLX509IssuerSerial data = new XMLX509IssuerSerial(document, + certs[0]); + X509Data x509Data = new X509Data(document); + x509Data.add(data); + secRef.setX509IssuerSerial(x509Data); + break; + + case WSConstants.X509_KEY_IDENTIFIER: + secRef.setKeyIdentifier(certs[0]); + break; + + case WSConstants.SKI_KEY_IDENTIFIER: + secRef.setKeyIdentifierSKI(certs[0], crypto); + break; + + case WSConstants.UT_SIGNING: + Reference refUt = new Reference(document); + refUt.setValueType(WSConstants.USERNAMETOKEN_NS + "#UsernameToken"); + String utId = usernameToken.getId(); + refUt.setURI("#" + utId); + secRef.setReference(refUt); + secretKey = usernameToken.getSecretKey(); + break; + + case WSConstants.THUMBPRINT_IDENTIFIER: + secRef.setKeyIdentifierThumb(certs[0]); + break; + + case WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER: + secRef.setKeyIdentifierEncKeySHA1(this.encrKeySha1value); + break; - case WSConstants.CUSTOM_SYMM_SIGNING : + case WSConstants.CUSTOM_SYMM_SIGNING : Reference refCust = new Reference(document); refCust.setValueType(this.customTokenValueType); refCust.setURI("#" + this.customTokenId); secRef.setReference(refCust); - break; - default: - throw new WSSecurityException(WSSecurityException.FAILURE, - "unsupportedKeyId"); - } - keyInfo.addUnknownElement(secRef.getElement()); - - } - - /** - * This method adds references to the Signature. - * - * The added references are signed when calling - * <code>computeSignature()</code>. This method can be called several - * times to add references as required. <code>addReferencesToSign()</code> - * can be called any time after <code>prepare</code>. - * - * @param references - * A vector containing <code>WSEncryptionPart</code> objects - * that define the parts to sign. - * @param secHeader - * Used to compute namespaces to be inserted by - * InclusiveNamespaces to be WSI compliant. - * @throws WSSecurityException - */ - public void addReferencesToSign(Vector references, WSSecHeader secHeader) - throws WSSecurityException { - Transforms transforms = null; - - Element envelope = document.getDocumentElement(); - - for (int part = 0; part < references.size(); part++) { - WSEncryptionPart encPart = (WSEncryptionPart) references.get(part); - - String idToSign = encPart.getId(); - - String elemName = encPart.getName(); - String nmSpace = encPart.getNamespace(); - - /* - * Set up the elements to sign. There are two reserved element - * names: "Token" and "STRTransform" "Token": Setup the Signature to - * either sign the information that points to the security token or - * the token itself. If its a direct reference sign the token, - * otherwise sign the KeyInfo Element. "STRTransform": Setup the - * ds:Reference to use STR Transform - * - */ - transforms = new Transforms(document); - try { - if (idToSign != null) { - Element toSignById = WSSecurityUtil.findElementById( - document.getDocumentElement(), idToSign, - WSConstants.WSU_NS); - if (toSignById == null) { - toSignById = WSSecurityUtil.findElementById(document - .getDocumentElement(), idToSign, null); - } - transforms - .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); - if (wssConfig.isWsiBSPCompliant()) { - transforms.item(0).getElement().appendChild( - new InclusiveNamespaces(document, - getInclusivePrefixes(toSignById)) - .getElement()); - } - sig.addDocument("#" + idToSign, transforms, digestAlgo); - } else if (elemName.equals("Token")) { - transforms - .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); - if (keyIdentifierType == WSConstants.BST_DIRECT_REFERENCE) { - if (wssConfig.isWsiBSPCompliant()) { - transforms - .item(0) - .getElement() - .appendChild( - new InclusiveNamespaces( - document, - getInclusivePrefixes(secHeader.getSecurityHeader())) - .getElement()); - } - sig.addDocument("#" + certUri, transforms, digestAlgo); - } else { - if (wssConfig.isWsiBSPCompliant()) { - transforms.item(0).getElement().appendChild( - new InclusiveNamespaces(document, - getInclusivePrefixes(keyInfo - .getElement())) - .getElement()); - } - sig.addDocument("#" + keyInfoUri, transforms, digestAlgo); - } - } else if (elemName.equals("STRTransform")) { // STRTransform - Element ctx = createSTRParameter(document); - transforms.addTransform( - STRTransform.implementedTransformURI, ctx); - sig.addDocument("#" + strUri, transforms, digestAlgo); - } else if (elemName.equals("Assertion")) { // Assertion - - String id = null; - id = SAMLUtil.getAssertionId(envelope, elemName, nmSpace); - - Element body = (Element) WSSecurityUtil.findElement( - envelope, elemName, nmSpace); - if (body == null) { - throw new WSSecurityException( - WSSecurityException.FAILURE, "noEncElement", - new Object[] { nmSpace + ", " + elemName }); - } - transforms - .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); - if (wssConfig.isWsiBSPCompliant()) { - transforms.item(0).getElement().appendChild( - new InclusiveNamespaces(document, - getInclusivePrefixes(body)) - .getElement()); - } - String prefix = WSSecurityUtil.setNamespace(body, - WSConstants.WSU_NS, WSConstants.WSU_PREFIX); - body.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id); - sig.addDocument("#" + id, transforms, digestAlgo); - - } else { - Element body = (Element) WSSecurityUtil.findElement( - envelope, elemName, nmSpace); - if (body == null) { - throw new WSSecurityException( - WSSecurityException.FAILURE, "noEncElement", - new Object[] { nmSpace + ", " + elemName }); - } - transforms - .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); - if (wssConfig.isWsiBSPCompliant()) { - transforms.item(0).getElement().appendChild( - new InclusiveNamespaces(document, - getInclusivePrefixes(body)) - .getElement()); - } - sig.addDocument("#" + setWsuId(body), transforms, digestAlgo); - } - } catch (TransformationException e1) { - throw new WSSecurityException( - WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, - e1); - } catch (XMLSignatureException e1) { - throw new WSSecurityException( - WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, - e1); - } - } - } - - /** - * Prepends the Signature element to the elements already in the Security - * header. - * - * The method can be called any time after <code>prepare()</code>. - * This allows to insert the Signature element at any position in the - * Security header. - * - * @param secHeader - * The secHeader that holds the Signature element. - */ - public void prependToHeader(WSSecHeader secHeader) { - WSSecurityUtil.prependChildElement(document, secHeader.getSecurityHeader(), sig - .getElement(), false); - } + break; + default: + throw new WSSecurityException(WSSecurityException.FAILURE, + "unsupportedKeyId"); + } + keyInfo.addUnknownElement(secRef.getElement()); + + } + + /** + * This method adds references to the Signature. + * + * The added references are signed when calling + * <code>computeSignature()</code>. This method can be called several + * times to add references as required. <code>addReferencesToSign()</code> + * can be called any time after <code>prepare</code>. + * + * @param references + * A vector containing <code>WSEncryptionPart</code> objects + * that define the parts to sign. + * @param secHeader + * Used to compute namespaces to be inserted by + * InclusiveNamespaces to be WSI compliant. + * @throws WSSecurityException + */ + public void addReferencesToSign(Vector references, WSSecHeader secHeader) + throws WSSecurityException { + Transforms transforms = null; + + Element envelope = document.getDocumentElement(); + + for (int part = 0; part < references.size(); part++) { + WSEncryptionPart encPart = (WSEncryptionPart) references.get(part); + + String idToSign = encPart.getId(); + + String elemName = encPart.getName(); + String nmSpace = encPart.getNamespace(); + + /* + * Set up the elements to sign. There are two reserved element + * names: "Token" and "STRTransform" "Token": Setup the Signature to + * either sign the information that points to the security token or + * the token itself. If its a direct reference sign the token, + * otherwise sign the KeyInfo Element. "STRTransform": Setup the + * ds:Reference to use STR Transform + * + */ + transforms = new Transforms(document); + try { + if (idToSign != null) { + Element toSignById = WSSecurityUtil.findElementById( + document.getDocumentElement(), idToSign, + WSConstants.WSU_NS); + if (toSignById == null) { + toSignById = WSSecurityUtil.findElementById(document + .getDocumentElement(), idToSign, null); + } + transforms + .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); + if (wssConfig.isWsiBSPCompliant()) { + transforms.item(0).getElement().appendChild( + new InclusiveNamespaces(document, + getInclusivePrefixes(toSignById)) + .getElement()); + } + sig.addDocument("#" + idToSign, transforms, digestAlgo); + } else if (elemName.equals("Token")) { + transforms + .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); + if (keyIdentifierType == WSConstants.BST_DIRECT_REFERENCE) { + if (wssConfig.isWsiBSPCompliant()) { + transforms + .item(0) + .getElement() + .appendChild( + new InclusiveNamespaces( + document, + getInclusivePrefixes(secHeader.getSecurityHeader())) + .getElement()); + } + sig.addDocument("#" + certUri, transforms, digestAlgo); + } else { + if (wssConfig.isWsiBSPCompliant()) { + transforms.item(0).getElement().appendChild( + new InclusiveNamespaces(document, + getInclusivePrefixes(keyInfo + .getElement())) + .getElement()); + } + sig.addDocument("#" + keyInfoUri, transforms, digestAlgo); + } + } else if (elemName.equals("STRTransform")) { // STRTransform + Element ctx = createSTRParameter(document); + transforms.addTransform( + STRTransform.implementedTransformURI, ctx); + sig.addDocument("#" + strUri, transforms, digestAlgo); + } else if (elemName.equals("Assertion")) { // Assertion + + String id = null; + id = SAMLUtil.getAssertionId(envelope, elemName, nmSpace); + + Element body = (Element) WSSecurityUtil.findElement( + envelope, elemName, nmSpace); + if (body == null) { + throw new WSSecurityException( + WSSecurityException.FAILURE, "noEncElement", + new Object[] { nmSpace + ", " + elemName }); + } + transforms + .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); + if (wssConfig.isWsiBSPCompliant()) { + transforms.item(0).getElement().appendChild( + new InclusiveNamespaces(document, + getInclusivePrefixes(body)) + .getElement()); + } + String prefix = WSSecurityUtil.setNamespace(body, + WSConstants.WSU_NS, WSConstants.WSU_PREFIX); + body.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id); + sig.addDocument("#" + id, transforms, digestAlgo); + + } else { + Element body = (Element) WSSecurityUtil.findElement( + envelope, elemName, nmSpace); + if (body == null) { + throw new WSSecurityException( + WSSecurityException.FAILURE, "noEncElement", + new Object[] { nmSpace + ", " + elemName }); + } + transforms + .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); + if (wssConfig.isWsiBSPCompliant()) { + transforms.item(0).getElement().appendChild( + new InclusiveNamespaces(document, + getInclusivePrefixes(body)) + .getElement()); + } + sig.addDocument("#" + setWsuId(body), transforms, digestAlgo); + } + } catch (TransformationException e1) { + throw new WSSecurityException( + WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, + e1); + } catch (XMLSignatureException e1) { + throw new WSSecurityException( + WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, + e1); + } + } + } + + /** + * Prepends the Signature element to the elements already in the Security + * header. + * + * The method can be called any time after <code>prepare()</code>. + * This allows to insert the Signature element at any position in the + * Security header. + * + * @param secHeader + * The secHeader that holds the Signature element. + */ + public void prependToHeader(WSSecHeader secHeader) { + WSSecurityUtil.prependChildElement(document, secHeader.getSecurityHeader(), sig + .getElement(), false); + } /** * Appends the Signature element to the elements already in the Security @@ -637,24 +637,24 @@ .getElement()); } - /** - * Prepend the BinarySecurityToken to the elements already in the Security - * header. - * - * The method can be called any time after <code>prepare()</code>. - * This allows to insert the BST element at any position in the Security - * header. - * - * @param secHeader - * The security header that holds the BST element. - */ - public void prependBSTElementToHeader(WSSecHeader secHeader) { - if (bstToken != null) { - WSSecurityUtil.prependChildElement(document, secHeader.getSecurityHeader(), - bstToken.getElement(), false); - } - bstToken = null; - } + /** + * Prepend the BinarySecurityToken to the elements already in the Security + * header. + * + * The method can be called any time after <code>prepare()</code>. + * This allows to insert the BST element at any position in the Security + * header. + * + * @param secHeader + * The security header that holds the BST element. + */ + public void prependBSTElementToHeader(WSSecHeader secHeader) { + if (bstToken != null) { + WSSecurityUtil.prependChildElement(document, secHeader.getSecurityHeader(), + bstToken.getElement(), false); + } + bstToken = null; + } /** * Returns the SignatureElement. @@ -686,167 +686,167 @@ bstToken = null; } - /** - * Compute the Signature over the references. - * - * After references are set this method computes the Signature for them. - * This method can be called any time after the references were set. See - * <code>addReferencesToSign()</code>. - * - * @throws WSSecurityException - */ - public void computeSignature() throws WSSecurityException { - WSDocInfoStore.store(wsDocInfo); - try { - if (keyIdentifierType == WSConstants.UT_SIGNING || - keyIdentifierType == WSConstants.CUSTOM_SYMM_SIGNING || - keyIdentifierType == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER) { - sig.sign(sig.createSecretKey(secretKey)); - } else { - sig.sign(crypto.getPrivateKey(user, password)); - } - signatureValue = sig.getSignatureValue(); - } catch (XMLSignatureException e1) { - throw new WSSecurityException(WSSecurityException.FAILED_SIGNATURE, - null, null, e1); - } catch (Exception e1) { - throw new WSSecurityException(WSSecurityException.FAILED_SIGNATURE, - null, null, e1); - } finally { - WSDocInfoStore.delete(wsDocInfo); - } - - } - - /** - * Builds a signed soap envelope. - * - * This is a convenience method and for backward compatibility. The method - * creates a Signature and puts it into the Security header. It does so by - * calling the single functions in order to perform a <i>one shot signature</i>. - * This method is compatible with the build method of the previous version - * with the exception of the additional WSSecHeader parameter. - * - * @param doc - * The unsigned SOAP envelope as <code>Document</code> - * @param cr - * An instance of the Crypto API to handle keystore and - * certificates - * @param secHeader - * the security header element to hold the encrypted key element. - * @return A signed SOAP envelope as <code>Document</code> - * @throws WSSecurityException - */ - public Document build(Document doc, Crypto cr, WSSecHeader secHeader) - throws WSSecurityException { - doDebug = log.isDebugEnabled(); - - if (doDebug) { - log.debug("Beginning signing..."); - } - - prepare(doc, cr, secHeader); - - SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(doc - .getDocumentElement()); - - if (parts == null) { - parts = new Vector(); - WSEncryptionPart encP = new WSEncryptionPart(soapConstants - .getBodyQName().getLocalPart(), soapConstants - .getEnvelopeURI(), "Content"); - parts.add(encP); - } - - addReferencesToSign(parts, secHeader); - - prependToHeader(secHeader); - - /* - * if we have a BST prepend it in front of the Signature according to - * strict layout rules. - */ - if (bstToken != null) { - prependBSTElementToHeader(secHeader); - } - - computeSignature(); - - return (doc); - } - - protected Element createSTRParameter(Document doc) { - Element transformParam = doc.createElementNS(WSConstants.WSSE_NS, - WSConstants.WSSE_PREFIX + ":TransformationParameters"); - - WSSecurityUtil.setNamespace(transformParam, WSConstants.WSSE_NS, - WSConstants.WSSE_PREFIX); - - Element canonElem = doc.createElementNS(WSConstants.SIG_NS, - WSConstants.SIG_PREFIX + ":CanonicalizationMethod"); - - WSSecurityUtil.setNamespace(canonElem, WSConstants.SIG_NS, - WSConstants.SIG_PREFIX); - - canonElem.setAttributeNS(null, "Algorithm", - Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); - transformParam.appendChild(canonElem); - return transformParam; - } - - protected Set getInclusivePrefixes(Element target) { - return getInclusivePrefixes(target, true); - } - - protected Set getInclusivePrefixes(Element target, boolean excludeVisible) { - Set result = new HashSet(); - Node parent = target; - NamedNodeMap attributes; - Node attribute; - while (!(parent.getParentNode() instanceof Document)) { - parent = parent.getParentNode(); - attributes = parent.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - attribute = attributes.item(i); - if (attribute.getNamespaceURI() != null - && attribute.getNamespaceURI().equals( - org.apache.ws.security.WSConstants.XMLNS_NS)) { - if (attribute.getNodeName().equals("xmlns")) { - result.add("#default"); - } else { - result.add(attribute.getLocalName()); - } - } - } - } - - if (excludeVisible == true) { - attributes = target.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - attribute = attributes.item(i); - if (attribute.getNamespaceURI() != null - && attribute.getNamespaceURI().equals( - org.apache.ws.security.WSConstants.XMLNS_NS)) { - if (attribute.getNodeName().equals("xmlns")) { - result.remove("#default"); - } else { - result.remove(attribute.getLocalName()); - } - } - if (attribute.getPrefix() != null) { - result.remove(attribute.getPrefix()); - } - } - - if (target.getPrefix() == null) { - result.remove("#default"); - } else { - result.remove(target.getPrefix()); - } - } + /** + * Compute the Signature over the references. + * + * After references are set this method computes the Signature for them. + * This method can be called any time after the references were set. See + * <code>addReferencesToSign()</code>. + * + * @throws WSSecurityException + */ + public void computeSignature() throws WSSecurityException { + WSDocInfoStore.store(wsDocInfo); + try { + if (keyIdentifierType == WSConstants.UT_SIGNING || + keyIdentifierType == WSConstants.CUSTOM_SYMM_SIGNING || + keyIdentifierType == WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER) { + sig.sign(sig.createSecretKey(secretKey)); + } else { + sig.sign(crypto.getPrivateKey(user, password)); + } + signatureValue = sig.getSignatureValue(); + } catch (XMLSignatureException e1) { + throw new WSSecurityException(WSSecurityException.FAILED_SIGNATURE, + null, null, e1); + } catch (Exception e1) { + throw new WSSecurityException(WSSecurityException.FAILED_SIGNATURE, + null, null, e1); + } finally { + WSDocInfoStore.delete(wsDocInfo); + } + + } + + /** + * Builds a signed soap envelope. + * + * This is a convenience method and for backward compatibility. The method + * creates a Signature and puts it into the Security header. It does so by + * calling the single functions in order to perform a <i>one shot signature</i>. + * This method is compatible with the build method of the previous version + * with the exception of the additional WSSecHeader parameter. + * + * @param doc + * The unsigned SOAP envelope as <code>Document</code> + * @param cr + * An instance of the Crypto API to handle keystore and + * certificates + * @param secHeader + * the security header element to hold the encrypted key element. + * @return A signed SOAP envelope as <code>Document</code> + * @throws WSSecurityException + */ + public Document build(Document doc, Crypto cr, WSSecHeader secHeader) + throws WSSecurityException { + doDebug = log.isDebugEnabled(); + + if (doDebug) { + log.debug("Beginning signing..."); + } + + prepare(doc, cr, secHeader); - return result; - } + SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(doc + .getDocumentElement()); + + if (parts == null) { + parts = new Vector(); + WSEncryptionPart encP = new WSEncryptionPart(soapConstants + .getBodyQName().getLocalPart(), soapConstants + .getEnvelopeURI(), "Content"); + parts.add(encP); + } + + addReferencesToSign(parts, secHeader); + + prependToHeader(secHeader); + + /* + * if we have a BST prepend it in front of the Signature according to + * strict layout rules. + */ + if (bstToken != null) { + prependBSTElementToHeader(secHeader); + } + + computeSignature(); + + return (doc); + } + + protected Element createSTRParameter(Document doc) { + Element transformParam = doc.createElementNS(WSConstants.WSSE_NS, + WSConstants.WSSE_PREFIX + ":TransformationParameters"); + + WSSecurityUtil.setNamespace(transformParam, WSConstants.WSSE_NS, + WSConstants.WSSE_PREFIX); + + Element canonElem = doc.createElementNS(WSConstants.SIG_NS, + WSConstants.SIG_PREFIX + ":CanonicalizationMethod"); + + WSSecurityUtil.setNamespace(canonElem, WSConstants.SIG_NS, + WSConstants.SIG_PREFIX); + + canonElem.setAttributeNS(null, "Algorithm", + Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); + transformParam.appendChild(canonElem); + return transformParam; + } + + protected Set getInclusivePrefixes(Element target) { + return getInclusivePrefixes(target, true); + } + + protected Set getInclusivePrefixes(Element target, boolean excludeVisible) { + Set result = new HashSet(); + Node parent = target; + NamedNodeMap attributes; + Node attribute; + while (!(parent.getParentNode() instanceof Document)) { + parent = parent.getParentNode(); + attributes = parent.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + attribute = attributes.item(i); + if (attribute.getNamespaceURI() != null + && attribute.getNamespaceURI().equals( + org.apache.ws.security.WSConstants.XMLNS_NS)) { + if (attribute.getNodeName().equals("xmlns")) { + result.add("#default"); + } else { + result.add(attribute.getLocalName()); + } + } + } + } + + if (excludeVisible == true) { + attributes = target.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + attribute = attributes.item(i); + if (attribute.getNamespaceURI() != null + && attribute.getNamespaceURI().equals( + org.apache.ws.security.WSConstants.XMLNS_NS)) { + if (attribute.getNodeName().equals("xmlns")) { + result.remove("#default"); + } else { + result.remove(attribute.getLocalName()); + } + } + if (attribute.getPrefix() != null) { + result.remove(attribute.getPrefix()); + } + } + + if (target.getPrefix() == null) { + result.remove("#default"); + } else { + result.remove(target.getPrefix()); + } + } + + return result; + } public void setSecretKey(byte[] secretKey) { this.secretKey = secretKey; @@ -863,5 +863,5 @@ public void setEncrKeySha1value(String encrKeySha1value) { this.encrKeySha1value = encrKeySha1value; } - + } Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java?rev=700768&r1=700767&r2=700768&view=diff ============================================================================== --- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java (original) +++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java Wed Oct 1 06:56:10 2008 @@ -46,50 +46,50 @@ public WSSecSignatureConfirmation() { } - /** - * Set the Signature value to store in this SignatureConfirmation. - * - * @param signatureValue - * The Signature value to store in the SignatureConfirmation - * element - */ - public void setSignatureValue(byte[] signatureValue) { - this.signatureValue = signatureValue; - } + /** + * Set the Signature value to store in this SignatureConfirmation. + * + * @param signatureValue + * The Signature value to store in the SignatureConfirmation + * element + */ + public void setSignatureValue(byte[] signatureValue) { + this.signatureValue = signatureValue; + } - /** - * Creates a SignatureConfimation element. - * - * The method prepares and initializes a WSSec SignatureConfirmation structure after - * the relevant information was set. Before calling <code>prepare()</code> the - * filed <code>signatureValue</code> must be set - * - * @param doc - * The SOAP envelope as W3C document - */ - public void prepare(Document doc) { - document = doc; + /** + * Creates a SignatureConfimation element. + * + * The method prepares and initializes a WSSec SignatureConfirmation structure after + * the relevant information was set.
{'source': 'Apache Software Foundation Public Mail Archives'}