You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/01/25 17:03:37 UTC

svn commit: r1063330 [1/2] - in /santuario/xml-security-java/trunk: .settings/ samples/javax/xml/crypto/dsig/samples/ samples/org/apache/xml/security/samples/ samples/org/apache/xml/security/samples/canonicalization/ samples/org/apache/xml/security/sam...

Author: coheigea
Date: Tue Jan 25 16:03:35 2011
New Revision: 1063330

URL: http://svn.apache.org/viewvc?rev=1063330&view=rev
Log:
[SANTUARIO-252] - Removed Xalan org.apache.xpath from the test and sample code.

Added:
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/DSNamespaceContext.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/DSNamespaceContext.java
Removed:
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/external/
Modified:
    santuario/xml-security-java/trunk/.settings/org.eclipse.jdt.core.prefs
    santuario/xml-security-java/trunk/samples/javax/xml/crypto/dsig/samples/Validate.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/AxisVerifier.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/ResolverUsageHTTP.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/TestSignature.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifySignature.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractSign.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java
    santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315ExclusiveTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/encryption/BaltimoreEncTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/interop/InteropTestBase.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/CreateSignatureTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/ECDSASignatureTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/ProcessingInstructionTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/UnknownAlgoSignatureTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/XPointerResourceResolver.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/signature/XmlSecTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java

Modified: santuario/xml-security-java/trunk/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/.settings/org.eclipse.jdt.core.prefs?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/.settings/org.eclipse.jdt.core.prefs (original)
+++ santuario/xml-security-java/trunk/.settings/org.eclipse.jdt.core.prefs Tue Jan 25 16:03:35 2011
@@ -1,12 +1,270 @@
-#Tue Jan 04 11:09:20 GMT 2011
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.compliance=1.5
+#Tue Jan 25 10:14:10 GMT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=32
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=110
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=1
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=110
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

Modified: santuario/xml-security-java/trunk/samples/javax/xml/crypto/dsig/samples/Validate.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/javax/xml/crypto/dsig/samples/Validate.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/javax/xml/crypto/dsig/samples/Validate.java (original)
+++ santuario/xml-security-java/trunk/samples/javax/xml/crypto/dsig/samples/Validate.java Tue Jan 25 16:03:35 2011
@@ -15,6 +15,8 @@
  *
  */
 
+package javax.xml.crypto.dsig.samples;
+
 import javax.xml.crypto.*;
 import javax.xml.crypto.dsig.*;
 import javax.xml.crypto.dom.*;

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/AxisVerifier.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/AxisVerifier.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/AxisVerifier.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/AxisVerifier.java Tue Jan 25 16:03:35 2011
@@ -19,9 +19,12 @@ package org.apache.xml.security.samples;
 import java.io.File;
 import java.io.FileInputStream;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.utils.Constants;
-import org.apache.xpath.CachedXPathAPI;
 import org.w3c.dom.Element;
 
 /**
@@ -48,14 +51,16 @@ public class AxisVerifier {
         javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
         org.w3c.dom.Document doc = db.parse(new FileInputStream(signatureFile));
         String BaseURI = signatureFile.toURI().toURL().toString();
-        CachedXPathAPI xpathAPI = new CachedXPathAPI();
-        Element nsctx = doc.createElementNS(null, "nsctx");
-
-        nsctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:ds", Constants.SignatureSpecNS);
 
-        Element signatureElem = 
-            (Element) xpathAPI.selectSingleNode(doc, "//ds:Signature", nsctx);
-        XMLSignature sig = new XMLSignature(signatureElem, BaseURI);
+        XPathFactory xpf = XPathFactory.newInstance();
+        XPath xpath = xpf.newXPath();
+        xpath.setNamespaceContext(new DSNamespaceContext());
+
+        String expression = "//ds:Signature[1]";
+        Element sigElement = 
+            (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
+        
+        XMLSignature sig = new XMLSignature(sigElement, BaseURI);
         boolean verify = sig.checkSignatureValue(sig.getKeyInfo().getPublicKey());
 
         System.out.println("The signature is" + (verify ? " " : " not ") + "valid");

Added: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/DSNamespaceContext.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/DSNamespaceContext.java?rev=1063330&view=auto
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/DSNamespaceContext.java (added)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/DSNamespaceContext.java Tue Jan 25 16:03:35 2011
@@ -0,0 +1,60 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.xml.security.samples;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * A NamespaceContext implementation for digital signatures
+ */
+public class DSNamespaceContext implements NamespaceContext {
+    
+    private Map<String, String> namespaceMap = 
+        new HashMap<String, String>();
+    
+    public DSNamespaceContext() {
+        namespaceMap.put("ds", "http://www.w3.org/2000/09/xmldsig#");
+    }
+    
+    public DSNamespaceContext(Map<String, String> namespaces) {
+        this();
+        namespaceMap.putAll(namespaces);
+    }
+
+    public String getNamespaceURI(String arg0) {
+        return namespaceMap.get(arg0);
+    }
+
+    public String getPrefix(String arg0) {
+        for (String key : namespaceMap.keySet()) {
+            String value = namespaceMap.get(key);
+            if (value.equals(arg0)) {
+                return key;
+            }
+        }
+        return null;
+    }
+
+    public Iterator<String> getPrefixes(String arg0) {
+        return namespaceMap.keySet().iterator();
+    }
+}

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/ResolverUsageHTTP.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/ResolverUsageHTTP.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/ResolverUsageHTTP.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/ResolverUsageHTTP.java Tue Jan 25 16:03:35 2011
@@ -17,12 +17,15 @@
  */
 package org.apache.xml.security.samples;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
 import org.apache.xml.security.utils.resolver.ResourceResolver;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 /**
@@ -98,11 +101,17 @@ public class ResolverUsageHTTP {
         javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
         org.w3c.dom.Document doc =
             db.parse(new java.io.ByteArrayInputStream(inputStr.getBytes()));
-        Element context = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
 
-        Element dsElem = 
-            (Element) XPathAPI.selectSingleNode(doc, "//ds:Signature[1]", context);
-        XMLSignature signature = new XMLSignature(dsElem, currentSystemId);
+        XPathFactory xpf = XPathFactory.newInstance();
+        XPath xpath = xpf.newXPath();
+        xpath.setNamespaceContext(new DSNamespaceContext());
+
+        String expression = "//ds:Signature[1]";
+        Element sigElement = 
+            (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
+        
+        XMLSignature signature = 
+            new XMLSignature(sigElement, currentSystemId);
 
         // how can I reg my own keystore?
         boolean verify = signature.checkSignatureValue(signature.getKeyInfo().getPublicKey());

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java Tue Jan 25 16:03:35 2011
@@ -21,12 +21,15 @@ import java.io.ByteArrayInputStream;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.xml.security.c14n.Canonicalizer;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -83,9 +86,14 @@ public class CanonSubTree {
         Canonicalizer c14n =
             Canonicalizer
             .getInstance("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
-        Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
 
-        Node signedInfo = XPathAPI.selectSingleNode(doc, "//ds:SignedInfo", nscontext);
+        XPathFactory xpf = XPathFactory.newInstance();
+        XPath xpath = xpf.newXPath();
+        xpath.setNamespaceContext(new DSNamespaceContext());
+
+        String expression = "//ds:SignedInfo[1]";
+        Element signedInfo = 
+            (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
         byte outputBytes[] = c14n.canonicalizeSubtree(signedInfo);
 
         if (outputBytes != null) {

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java Tue Jan 25 16:03:35 2011
@@ -21,15 +21,18 @@ import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
 import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
 import org.apache.xml.security.utils.resolver.implementations.ResolverAnonymous;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 /**
@@ -150,9 +153,15 @@ public class IAIKInterOp {
 
             javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
             org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
-            Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+
+            XPathFactory xpf = XPathFactory.newInstance();
+            XPath xpath = xpf.newXPath();
+            xpath.setNamespaceContext(new DSNamespaceContext());
+
+            String expression = "//ds:Signature[1]";
             Element sigElement = 
-                (Element) XPathAPI.selectSingleNode(doc, "//ds:Signature[1]", nscontext);
+                (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
+            
             XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString());
 
             signature.setFollowNestedManifests(false);

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java Tue Jan 25 16:03:35 2011
@@ -20,13 +20,17 @@ package org.apache.xml.security.samples.
 import java.io.File;
 import java.security.PublicKey;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.keys.storage.StorageResolver;
 import org.apache.xml.security.keys.storage.implementations.CertsInFilesystemDirectoryResolver;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 /**
@@ -72,6 +76,10 @@ public class RetrievePublicKeys {
                                /* 9 */ "retrieval-from-same-doc.xml"
         };
 
+        XPathFactory xpf = XPathFactory.newInstance();
+        XPath xpath = xpf.newXPath();
+        xpath.setNamespaceContext(new DSNamespaceContext());
+
         int start = 0;
         int end = filenames.length;
         for (int filetoverify = start; filetoverify < end; filetoverify++) {
@@ -86,8 +94,9 @@ public class RetrievePublicKeys {
                     db.parse(new java.io.FileInputStream(filename));
                 Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
 
+                String expression = "//ds:KeyInfo[1]";
                 Element kiElement = 
-                    (Element) XPathAPI.selectSingleNode(doc, "//ds:KeyInfo[1]", nscontext);
+                    (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
                 KeyInfo ki = new KeyInfo(kiElement, (new File(filename)).toURI().toURL().toString());
                 StorageResolver storageResolver = 
                     new StorageResolver(new CertsInFilesystemDirectoryResolver(merlinsDir + "certs"));

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/TestSignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/TestSignature.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/TestSignature.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/TestSignature.java Tue Jan 25 16:03:35 2011
@@ -16,23 +16,24 @@
  */
 package org.apache.xml.security.samples.signature;
 
-
-
 import java.io.File;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.keys.storage.StorageResolver;
 import org.apache.xml.security.samples.utils.resolver.OfflineResolver;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
-
 /**
  * Class TestSignature
  *
@@ -94,13 +95,13 @@ public class TestSignature {
             org.w3c.dom.Document doc =
                db.parse(new java.io.FileInputStream(filename));
 
-            //create a namespace context for use in the XPath expression below
-            Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                                     Constants.SignatureSpecNS);
-
-            //retrieve the signature Element from the document
-            Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
-                                    "//ds:Signature[1]", nscontext);
+            XPathFactory xpf = XPathFactory.newInstance();
+            XPath xpath = xpf.newXPath();
+            xpath.setNamespaceContext(new DSNamespaceContext());
+
+            String expression = "//ds:Signature[1]";
+            Element sigElement = 
+                (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
 
             //Creates a XMLSignature from the element and uses the filename as
             //the baseURI. That URI is prepended to all relative URIs.

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java Tue Jan 25 16:03:35 2011
@@ -20,12 +20,16 @@ package org.apache.xml.security.samples.
 
 import java.io.File;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.signature.SignedInfo;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
@@ -68,11 +72,15 @@ public class VerifyCollectableSignature 
 
          org.w3c.dom.Document doc =
             db.parse(new java.io.FileInputStream(signatureFile));
-         Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                                  Constants.SignatureSpecNS);
-         NodeList signatureElems = XPathAPI.selectNodeList(doc,
-                                      "//ds:Signature", nscontext);
 
+         XPathFactory xpf = XPathFactory.newInstance();
+         XPath xpath = xpf.newXPath();
+         xpath.setNamespaceContext(new DSNamespaceContext());
+
+         String expression = "//ds:Signature[1]";
+         NodeList signatureElems = 
+             (NodeList) xpath.evaluate(expression, doc, XPathConstants.NODESET);
+         
          for (int i = 0; i < signatureElems.getLength(); i++) {
             Element sigElement = (Element) signatureElems.item(i);
             XMLSignature signature = new XMLSignature(sigElement, BaseURI);

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java Tue Jan 25 16:03:35 2011
@@ -23,12 +23,15 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 
@@ -162,10 +165,13 @@ public class VerifyMerlinsExamplesFiftee
 
       org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
 
-      Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                               Constants.SignatureSpecNS);
-      Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
-                              "//ds:Signature[1]", nscontext);
+      XPathFactory xpf = XPathFactory.newInstance();
+      XPath xpath = xpf.newXPath();
+      xpath.setNamespaceContext(new DSNamespaceContext());
+
+      String expression = "//ds:Signature[1]";
+      Element sigElement = 
+          (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
       XMLSignature signature = new XMLSignature(sigElement,
                                                 f.toURL().toString());
 

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java Tue Jan 25 16:03:35 2011
@@ -25,13 +25,16 @@ import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 
@@ -147,10 +150,13 @@ public class VerifyMerlinsExamplesSixtee
 
       org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
 
-      Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                               Constants.SignatureSpecNS);
-      Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
-                              "//ds:Signature[1]", nscontext);
+      XPathFactory xpf = XPathFactory.newInstance();
+      XPath xpath = xpf.newXPath();
+      xpath.setNamespaceContext(new DSNamespaceContext());
+
+      String expression = "//ds:Signature[1]";
+      Element sigElement = 
+          (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
       XMLSignature signature = new XMLSignature(sigElement,
                                                 f.toURL().toString());
 
@@ -205,20 +211,6 @@ public class VerifyMerlinsExamplesSixtee
       } else {
          System.out.println("Did not find a KeyInfo");
       }
-
-      /*
-      SignedInfo s = signature.getSignedInfo();
-      for (int i=0; i<s.getSignedContentLength(); i++) {
-         System.out.println("################ Signed Resource " + i + " ################");
-         FileOutputStream f2 = new FileOutputStream(filename + "." + i + ".input");
-         byte[] data = s.getSignedContentItem(i);
-         f2.write(data);
-         f2.close();
-
-         System.out.println(new String(data));
-         System.out.println();
-      }
-      */
    }
 
    static {

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java Tue Jan 25 16:03:35 2011
@@ -25,13 +25,16 @@ import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
 
@@ -157,10 +160,13 @@ public class VerifyMerlinsExamplesTwenty
 
       org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
 
-      Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                               Constants.SignatureSpecNS);
-      Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
-                              "//ds:Signature[1]", nscontext);
+      XPathFactory xpf = XPathFactory.newInstance();
+      XPath xpath = xpf.newXPath();
+      xpath.setNamespaceContext(new DSNamespaceContext());
+
+      String expression = "//ds:Signature[1]";
+      Element sigElement = 
+          (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
       XMLSignature signature = new XMLSignature(sigElement,
                                                 f.toURL().toString());
 

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifySignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifySignature.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifySignature.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/VerifySignature.java Tue Jan 25 16:03:35 2011
@@ -16,31 +16,27 @@
  */
 package org.apache.xml.security.samples.signature;
 
-
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.samples.utils.resolver.OfflineResolver;
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 
-
 /**
- *
- *
- *
- *
  * @author $Author$
- *
  */
 public class VerifySignature {
 
@@ -117,12 +113,16 @@ public class VerifySignature {
          }
 
          org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
-         Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                                  Constants.SignatureSpecNS);
-         Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
-                                 "//ds:Signature[1]", nscontext);
+
+         XPathFactory xpf = XPathFactory.newInstance();
+         XPath xpath = xpf.newXPath();
+         xpath.setNamespaceContext(new DSNamespaceContext());
+
+         String expression = "//ds:Signature[1]";
+         Element sigElement = 
+             (Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
          XMLSignature signature = new XMLSignature(sigElement,
-                                                   f.toURL().toString());
+                                                   f.toURI().toURL().toString());
 
          signature.addResourceResolver(new OfflineResolver());
 

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractSign.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractSign.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractSign.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractSign.java Tue Jan 25 16:03:35 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.samples.signature.contract;
 
-
-
 import java.io.File;
 import java.io.FileOutputStream;
 
@@ -31,13 +29,12 @@ import org.apache.xml.security.utils.XML
 import org.w3c.dom.Element;
 
 
-
 /**
  * In the past the protokol to sign data (like a contract) from more than one people
  * looks like this:
- * 1. A signes the hash of the data => SignatureA
- * 2. B signes SignatureA => SignatureB
- * 3. C signes SignatureB => SignatureC
+ * 1. A signs the hash of the data => SignatureA
+ * 2. B signs SignatureA => SignatureB
+ * 3. C signs SignatureB => SignatureC
  *
  * To verify e.g. signature C the following steps were necessary:
  * 1. Verify signature C thereby decrypt SignatureC (SignatureB)
@@ -53,282 +50,260 @@ import org.w3c.dom.Element;
  * @author Rene Kollmorgen <Re...@softwareag.com>
  */
 public class ThreeSignerContractSign {
+    
+    static {
+        org.apache.xml.security.Init.init();
+
+        // org.apache.xml.security.utils.Constants.setSignatureSpecNSprefix("");
+    }
+
+    /**
+     * Method main
+     *
+     * @param unused
+     * @throws Exception
+     */
+    public static void main(String unused[]) throws Exception {
+        File signatureFile = new File("threeSignerContract.xml");
+        String BaseURI = signatureFile.toURI().toURL().toString();
+        javax.xml.parsers.DocumentBuilderFactory dbf =
+            javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+        dbf.setNamespaceAware(true);
+
+        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+        org.w3c.dom.Document doc = db.newDocument();
+        Element contract = doc.createElementNS(null, "contract");
+
+        // create contract ////////////////////////////////////////////
+        doc.appendChild(contract);
+
+        // beautifying //////
+        Element condition1 = doc.createElementNS(null, "condition1");
+
+        condition1.setAttributeNS(null, "Id", "cond1");
+        condition1.appendChild(
+            doc.createTextNode(
+                "condition1 not covered in first signature, only "
+                + "binding for the second and third signer"));
+
+        Element condition2 = doc.createElementNS(null, "condition2");
+
+        condition2.appendChild(doc.createTextNode("condition2"));
+
+        Element condition3 = doc.createElementNS(null, "condition3");
+
+        condition3.appendChild(doc.createTextNode("condition3"));
+        contract.appendChild(doc.createTextNode("\n"));
+        contract.appendChild(condition1);
+        contract.appendChild(doc.createTextNode("\n"));
+        contract.appendChild(condition2);
+        contract.appendChild(doc.createTextNode("\n"));
+        contract.appendChild(condition3);
+        contract.appendChild(doc.createTextNode("\n"));
+
+        String id1 = "firstSigner";
+        String id2 = "secondSigner";
+        String id3 = "thirdSigner";
 
-   /**
-    * Method main
-    *
-    * @param unused
-    * @throws Exception
-    */
-   public static void main(String unused[]) throws Exception {
-      //J-
-      File signatureFile = new File("threeSignerContract.xml");
-      String BaseURI = signatureFile.toURL().toString();
-      //J+
-      javax.xml.parsers.DocumentBuilderFactory dbf =
-         javax.xml.parsers.DocumentBuilderFactory.newInstance();
-
-      dbf.setNamespaceAware(true);
-
-      javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
-      org.w3c.dom.Document doc = db.newDocument();
-      Element contract = doc.createElementNS(null, "contract");
-
-      // create contract ////////////////////////////////////////////
-      doc.appendChild(contract);
-
-      // beautifying //////
-      Element condition1 = doc.createElementNS(null, "condition1");
-
-      condition1.setAttributeNS(null, "Id", "cond1");
-      condition1.appendChild(
-         doc.createTextNode(
-            "condition1 not covered in first signature, only binding for the second and third signer"));
-
-      Element condition2 = doc.createElementNS(null, "condition2");
-
-      condition2.appendChild(doc.createTextNode("condition2"));
-
-      Element condition3 = doc.createElementNS(null, "condition3");
-
-      condition3.appendChild(doc.createTextNode("condition3"));
-      contract.appendChild(doc.createTextNode("\n"));
-      contract.appendChild(condition1);
-      contract.appendChild(doc.createTextNode("\n"));
-      contract.appendChild(condition2);
-      contract.appendChild(doc.createTextNode("\n"));
-      contract.appendChild(condition3);
-      contract.appendChild(doc.createTextNode("\n"));
-
-      //J-
-      String id1 = "firstSigner";
-      String id2 = "secondSigner";
-      String id3 = "thirdSigner";
-
-      // sign the whole contract and no signature and exclude condition1
-      String xp1Old = "not(ancestor-or-self::ds:Signature)"
+        // sign the whole contract and no signature and exclude condition1
+        String xp1Old = "not(ancestor-or-self::ds:Signature)"
             + " and not(ancestor-or-self::node()[@Id='cond1'])";
 
-      // sign the contract with condition2 and codition3 and no signature
-      String xp1 = "not(ancestor-or-self::ds:Signature)" + "\n"
-                + " and (" + "\n"
-                + "    (ancestor-or-self::node() = /contract/condition2) " + "\n"
-                + " or (ancestor-or-self::node() = /contract/condition3) " + "\n"
-                + " or (self::node() = /contract) " + "\n"
-                + " or ((parent::node() = /contract) and (self::text()))" + "\n"
-                + ")";
-
-      // sign the whole contract and no signature but the first
-      String xp2 = "not(ancestor-or-self::ds:Signature)" + "\n"
-                 + " or ancestor-or-self::ds:Signature[@Id='" + id1 + "']";
-
-      // sign the whole contract and no signature but the first and the second
-      String xp3 = "not(ancestor-or-self::ds:Signature)" + "\n"
-                 + " or ancestor-or-self::ds:Signature[@Id='" + id1 + "']" + "\n"
-                 + " or ancestor-or-self::ds:Signature[@Id='" + id2 + "']";
-      //J+
-      //////////////////////////////////////////////////////////////////
-      // first signer //////////////////////////////////////////////////
-      //////////////////////////////////////////////////////////////////
-      {
-         XMLSignature firstSigner =
-            new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
-
-         firstSigner.setId(id1);
-         contract.appendChild(firstSigner.getElement());
-
-         String rootnamespace = contract.getNamespaceURI();
-         boolean rootprefixed = (rootnamespace != null)
-                                && (rootnamespace.length() > 0);
-         String rootlocalname = contract.getNodeName();
-         Transforms transforms = new Transforms(doc);
-         XPathContainer xpath = new XPathContainer(doc);
-
-         xpath.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
-         xpath.setXPath("\n" + xp1 + "\n");
-         transforms.addTransform(Transforms.TRANSFORM_XPATH,
-                                 xpath.getElementPlusReturns());
-         firstSigner.addDocument("", transforms, Constants.ALGO_ID_DIGEST_SHA1);
-
-         {
-
-            // not really secure ///////////////////
-            firstSigner.getKeyInfo().add(new KeyName(doc, "First signer key"));
-
-            ////////////////////////////////////////////////
-            System.out.println("First signer: Start signing");
-            firstSigner
-               .sign(firstSigner
-                  .createSecretKey("First signer key".getBytes()));
-            System.out.println("First signer: Finished signing");
-         }
-
-         SignedInfo s = firstSigner.getSignedInfo();
-
-         for (int i = 0; i < s.getSignedContentLength(); i++) {
-            System.out.println("################ Signed Resource " + i
-                               + " ################");
-            System.out.println(new String(s.getSignedContentItem(i)));
-            System.out.println();
-         }
-      }
-
-      //////////////////////////////////////////////////////////////////
-      // second signer /////////////////////////////////////////////////
-      //////////////////////////////////////////////////////////////////
-      {
-         XMLSignature secondSigner = new XMLSignature(doc, BaseURI,
-                                        XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
-
-         secondSigner.setId(id2);
-         contract.appendChild(secondSigner.getElement());
-
-         Transforms transforms2 = new Transforms(doc);
-         XPathContainer xpath2 = new XPathContainer(doc);
-
-         xpath2.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
-         xpath2.setXPath("\n" + xp2 + "\n");
-         transforms2.addTransform(Transforms.TRANSFORM_XPATH,
-                                  xpath2.getElementPlusReturns());
-         secondSigner.addDocument("", transforms2,
-                                  Constants.ALGO_ID_DIGEST_SHA1);
-
-         {
-            secondSigner.getKeyInfo().add(new KeyName(doc,
-                                                      "Second signer key"));
-            System.out.println("Second signer: Start signing");
-            secondSigner
-               .sign(secondSigner
-                  .createSecretKey("Second signer key".getBytes()));
-            System.out.println("Second signer: Finished signing");
-         }
-
-         SignedInfo s2 = secondSigner.getSignedInfo();
-
-         for (int i = 0; i < s2.getSignedContentLength(); i++) {
-            System.out.println("################ Signed Resource " + i
-                               + " ################");
-            System.out.println(new String(s2.getSignedContentItem(i)));
-            System.out.println();
-         }
-      }
-
-      //////////////////////////////////////////////////////////////////
-      // third signer //////////////////////////////////////////////////
-      //////////////////////////////////////////////////////////////////
-      {
-         XMLSignature thirdSigner =
-            new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
-
-         thirdSigner.setId(id3);
-         contract.appendChild(thirdSigner.getElement());
-
-         Transforms transforms3 = new Transforms(doc);
-         XPathContainer xpath3 = new XPathContainer(doc);
-
-         xpath3.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
-         xpath3.setXPath("\n" + xp3 + "\n");
-         transforms3.addTransform(Transforms.TRANSFORM_XPATH,
-                                  xpath3.getElementPlusReturns());
-         thirdSigner.addDocument("", transforms3,
-                                 Constants.ALGO_ID_DIGEST_SHA1);
-
-         {
-            thirdSigner.getKeyInfo().add(new KeyName(doc, "Third signer key"));
-            System.out.println("Third signer: Start signing");
-            thirdSigner
-               .sign(thirdSigner
-                  .createSecretKey("Third signer key".getBytes()));
-            System.out.println("Third signer: Finished signing");
-         }
-
-         SignedInfo s3 = thirdSigner.getSignedInfo();
-
-         for (int i = 0; i < s3.getSignedContentLength(); i++) {
-            System.out.println("################ Signed Resource " + i
-                               + " ################");
-            System.out.println(new String(s3.getSignedContentItem(i)));
-            System.out.println();
-         }
-      }
-
-      //////////////////////////////////////////////////////////////////
-      // forth signer //////////////////////////////////////////////////
-      //////////////////////////////////////////////////////////////////
-      {
-         XMLSignature forthSigner =
-            new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
-
-         forthSigner.setId("sig4");
-         contract.appendChild(forthSigner.getElement());
-
-         {
-
-            // first of all, add the basic document without signatures
-            Transforms transforms4 = new Transforms(doc);
-            XPathContainer xpath4 = new XPathContainer(doc);
-
-            xpath4.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
-            xpath4.setXPath("\n" + "not(ancestor-or-self::ds:Signature)"
-                            + "\n");
-            transforms4.addTransform(Transforms.TRANSFORM_XPATH,
-                                     xpath4.getElementPlusReturns());
-            forthSigner.addDocument("", transforms4,
-                                    Constants.ALGO_ID_DIGEST_SHA1);
-         }
-
-         {
-
-            // then add the different signatures
-
-            /*
-            Transforms transforms4 = new Transforms(doc);
-            XPathContainer xpath4 = new XPathContainer(doc);
-
-            xpath4.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
-            xpath4.setXPath("\n" + "ancestor-or-self::ds:Signature[@Id='" + id1 + "']" + "\n");
-            transforms4.addTransform(Transforms.TRANSFORM_XPATH, xpath4.getElementPlusReturns());
-            forthSigner.addDocument("#xpointer(id('firstSigner'))", transforms4, Constants.ALGO_ID_DIGEST_SHA1, null, "ds:Signature");
-            */
-            forthSigner.addDocument("#xpointer(id('firstSigner'))", null,
-                                    Constants.ALGO_ID_DIGEST_SHA1, null,
-                                    "ds:Signature");
-         }
-
-         {
-            forthSigner.getKeyInfo().add(new KeyName(doc, "Forth signer key"));
-            System.out.println("Forth signer: Start signing");
-            forthSigner
-               .sign(forthSigner
-                  .createSecretKey("Forth signer key".getBytes()));
-            System.out.println("Forth signer: Finished signing");
-         }
-
-         SignedInfo s4 = forthSigner.getSignedInfo();
-
-         for (int i = 0; i < s4.getSignedContentLength(); i++) {
-            System.out.println("################ Signed Resource " + i
-                               + " ################");
-            System.out.println(new String(s4.getSignedContentItem(i)));
-            System.out.println();
-         }
-      }
-
-      //////////////////////////////////////////////////////////////////
-      // write away files
-      //////////////////////////////////////////////////////////////////
-      {
-         FileOutputStream f = new FileOutputStream(signatureFile);
-
-         XMLUtils.outputDOMc14nWithComments(doc, f);
-         f.close();
-         System.out.println("Wrote signature to " + BaseURI);
-      }
-   }
-
-   static {
-      org.apache.xml.security.Init.init();
+        // sign the contract with condition2 and codition3 and no signature
+        String xp1 = "not(ancestor-or-self::ds:Signature)" + "\n"
+        + " and (" + "\n"
+        + "    (ancestor-or-self::node() = /contract/condition2) " + "\n"
+        + " or (ancestor-or-self::node() = /contract/condition3) " + "\n"
+        + " or (self::node() = /contract) " + "\n"
+        + " or ((parent::node() = /contract) and (self::text()))" + "\n"
+        + ")";
+
+        // sign the whole contract and no signature but the first
+        String xp2 = "not(ancestor-or-self::ds:Signature)" + "\n"
+        + " or ancestor-or-self::ds:Signature[@Id='" + id1 + "']";
+
+        // sign the whole contract and no signature but the first and the second
+        String xp3 = "not(ancestor-or-self::ds:Signature)" + "\n"
+        + " or ancestor-or-self::ds:Signature[@Id='" + id1 + "']" + "\n"
+        + " or ancestor-or-self::ds:Signature[@Id='" + id2 + "']";
+        //////////////////////////////////////////////////////////////////
+        // first signer //////////////////////////////////////////////////
+        //////////////////////////////////////////////////////////////////
+        {
+            XMLSignature firstSigner =
+                new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
+
+            firstSigner.setId(id1);
+            contract.appendChild(firstSigner.getElement());
+
+            String rootnamespace = contract.getNamespaceURI();
+            boolean rootprefixed = (rootnamespace != null) && (rootnamespace.length() > 0);
+            String rootlocalname = contract.getNodeName();
+            Transforms transforms = new Transforms(doc);
+            XPathContainer xpath = new XPathContainer(doc);
+
+            xpath.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
+            xpath.setXPath("\n" + xp1 + "\n");
+            transforms.addTransform(Transforms.TRANSFORM_XPATH,
+                                    xpath.getElementPlusReturns());
+            firstSigner.addDocument("", transforms, Constants.ALGO_ID_DIGEST_SHA1);
+
+            {
+                // not really secure ///////////////////
+                firstSigner.getKeyInfo().add(new KeyName(doc, "First signer key"));
+
+                ////////////////////////////////////////////////
+                System.out.println("First signer: Start signing");
+                firstSigner.sign(
+                    firstSigner.createSecretKey("First signer key".getBytes()));
+                System.out.println("First signer: Finished signing");
+            }
+
+            SignedInfo s = firstSigner.getSignedInfo();
+
+            for (int i = 0; i < s.getSignedContentLength(); i++) {
+                System.out.println("################ Signed Resource " + i
+                                   + " ################");
+                System.out.println(new String(s.getSignedContentItem(i)));
+                System.out.println();
+            }
+        }
+
+        //////////////////////////////////////////////////////////////////
+        // second signer /////////////////////////////////////////////////
+        //////////////////////////////////////////////////////////////////
+        {
+            XMLSignature secondSigner = 
+                new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
+
+            secondSigner.setId(id2);
+            contract.appendChild(secondSigner.getElement());
+
+            Transforms transforms2 = new Transforms(doc);
+            XPathContainer xpath2 = new XPathContainer(doc);
+
+            xpath2.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
+            xpath2.setXPath("\n" + xp2 + "\n");
+            transforms2.addTransform(Transforms.TRANSFORM_XPATH,
+                                     xpath2.getElementPlusReturns());
+            secondSigner.addDocument("", transforms2, Constants.ALGO_ID_DIGEST_SHA1);
+
+            {
+                secondSigner.getKeyInfo().add(new KeyName(doc,
+                "Second signer key"));
+                System.out.println("Second signer: Start signing");
+                secondSigner.sign(
+                    secondSigner.createSecretKey("Second signer key".getBytes()));
+                System.out.println("Second signer: Finished signing");
+            }
+
+            SignedInfo s2 = secondSigner.getSignedInfo();
+
+            for (int i = 0; i < s2.getSignedContentLength(); i++) {
+                System.out.println("################ Signed Resource " + i
+                                   + " ################");
+                System.out.println(new String(s2.getSignedContentItem(i)));
+                System.out.println();
+            }
+        }
+
+        //////////////////////////////////////////////////////////////////
+        // third signer //////////////////////////////////////////////////
+        //////////////////////////////////////////////////////////////////
+        {
+            XMLSignature thirdSigner =
+                new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
+
+            thirdSigner.setId(id3);
+            contract.appendChild(thirdSigner.getElement());
+
+            Transforms transforms3 = new Transforms(doc);
+            XPathContainer xpath3 = new XPathContainer(doc);
+
+            xpath3.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
+            xpath3.setXPath("\n" + xp3 + "\n");
+            transforms3.addTransform(Transforms.TRANSFORM_XPATH,
+                                     xpath3.getElementPlusReturns());
+            thirdSigner.addDocument("", transforms3, Constants.ALGO_ID_DIGEST_SHA1);
+
+            {
+                thirdSigner.getKeyInfo().add(new KeyName(doc, "Third signer key"));
+                System.out.println("Third signer: Start signing");
+                thirdSigner.sign(
+                    thirdSigner.createSecretKey("Third signer key".getBytes()));
+                System.out.println("Third signer: Finished signing");
+            }
+
+            SignedInfo s3 = thirdSigner.getSignedInfo();
+
+            for (int i = 0; i < s3.getSignedContentLength(); i++) {
+                System.out.println("################ Signed Resource " + i
+                                   + " ################");
+                System.out.println(new String(s3.getSignedContentItem(i)));
+                System.out.println();
+            }
+        }
+
+        //////////////////////////////////////////////////////////////////
+        // forth signer //////////////////////////////////////////////////
+        //////////////////////////////////////////////////////////////////
+        {
+            XMLSignature forthSigner =
+                new XMLSignature(doc, BaseURI, XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
+
+            forthSigner.setId("sig4");
+            contract.appendChild(forthSigner.getElement());
+
+            {
+                // first of all, add the basic document without signatures
+                Transforms transforms4 = new Transforms(doc);
+                XPathContainer xpath4 = new XPathContainer(doc);
+
+                xpath4.setXPathNamespaceContext("ds", Constants.SignatureSpecNS);
+                xpath4.setXPath("\n" + "not(ancestor-or-self::ds:Signature)"
+                                + "\n");
+                transforms4.addTransform(Transforms.TRANSFORM_XPATH,
+                                         xpath4.getElementPlusReturns());
+                forthSigner.addDocument("", transforms4,
+                                        Constants.ALGO_ID_DIGEST_SHA1);
+            }
+
+            {
+                // then add the different signatures
+                forthSigner.addDocument("#xpointer(id('firstSigner'))", null,
+                                        Constants.ALGO_ID_DIGEST_SHA1, null,
+                "ds:Signature");
+            }
+
+            {
+                forthSigner.getKeyInfo().add(new KeyName(doc, "Forth signer key"));
+                System.out.println("Forth signer: Start signing");
+                forthSigner.sign(
+                    forthSigner.createSecretKey("Forth signer key".getBytes()));
+                System.out.println("Forth signer: Finished signing");
+            }
+
+            SignedInfo s4 = forthSigner.getSignedInfo();
+
+            for (int i = 0; i < s4.getSignedContentLength(); i++) {
+                System.out.println("################ Signed Resource " + i
+                                   + " ################");
+                System.out.println(new String(s4.getSignedContentItem(i)));
+                System.out.println();
+            }
+        }
+
+        //////////////////////////////////////////////////////////////////
+        // write away files
+        //////////////////////////////////////////////////////////////////
+        {
+            FileOutputStream f = new FileOutputStream(signatureFile);
+
+            XMLUtils.outputDOMc14nWithComments(doc, f);
+            f.close();
+            System.out.println("Wrote signature to " + BaseURI);
+        }
+    }
 
-      // org.apache.xml.security.utils.Constants.setSignatureSpecNSprefix("");
-   }
 }

Modified: santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java?rev=1063330&r1=1063329&r2=1063330&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java (original)
+++ santuario/xml-security-java/trunk/samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java Tue Jan 25 16:03:35 2011
@@ -16,96 +16,87 @@
  */
 package org.apache.xml.security.samples.signature.contract;
 
-
-
 import java.io.File;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.samples.DSNamespaceContext;
 import org.apache.xml.security.samples.SampleUtils;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.XMLUtils;
-import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-
 /**
  *
  * @author Rene Kollmorgen <Re...@softwareag.com>
  */
 public class ThreeSignerContractVerify {
-
-   /**
-    * Method main
-    *
-    * @param unused
-    * @throws Exception
-    */
-   public static void main(String unused[]) throws Exception {
-
-      javax.xml.parsers.DocumentBuilderFactory dbf =
-         javax.xml.parsers.DocumentBuilderFactory.newInstance();
-
-      dbf.setNamespaceAware(true);
-      dbf.setAttribute("http://xml.org/sax/features/namespaces", Boolean.TRUE);
-
-      try {
-
-         //File signatureFile = new File("collectableSignature.xml");
-         File signatureFile = new File("threeSignerContract.xml");
-         String BaseURI = signatureFile.toURL().toString();
-
-         System.out.println("Try to verify "
-                            + signatureFile.toURL().toString());
-
-         javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
-
-         db.setErrorHandler(new org.apache.xml.security.utils
-            .IgnoreAllErrorHandler());
-
-         org.w3c.dom.Document doc =
-            db.parse(new java.io.FileInputStream(signatureFile));
-         Element nscontext = SampleUtils.createDSctx(doc, "ds",
-                                                  Constants.SignatureSpecNS);
-         NodeList signatureElems = XPathAPI.selectNodeList(doc,
-                                      "//ds:Signature", nscontext);
-
-         for (int i = 0; i < signatureElems.getLength(); i++) {
-            Element sigElement = (Element) signatureElems.item(i);
-            XMLSignature signature = new XMLSignature(sigElement, BaseURI);
-
-            //byte[] secretKey = "secretValue".getBytes();
-            Element keyName =
-               (Element) sigElement
-                  .getElementsByTagNameNS(Constants.SignatureSpecNS, "KeyName")
-                     .item(0);
-            String keyValue = keyName.getFirstChild().getNodeValue();
-
-            System.out
-               .println("The signature number " + (i + 1) + " is "
-                        + (signature
-                           .checkSignatureValue(signature
-                              .createSecretKey(keyValue.getBytes()))
-                           ? "valid (good)"
-                           : "invalid !!!!! (bad)"));
-
-            /*
-            SignedInfo s = signature.getSignedInfo();
-
-            for (int j = 0; j < s.getSignedContentLength(); j++) {
-               System.out.println("################ Signed Resource " + i + "/"
-                                  + j + " ################");
-               System.out.println(new String(s.getSignedContentItem(j)));
-               System.out.println();
+    
+    static {
+        org.apache.xml.security.Init.init();
+    }
+
+    /**
+     * Method main
+     *
+     * @param unused
+     * @throws Exception
+     */
+    public static void main(String unused[]) throws Exception {
+
+        javax.xml.parsers.DocumentBuilderFactory dbf =
+            javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+        dbf.setNamespaceAware(true);
+        dbf.setAttribute("http://xml.org/sax/features/namespaces", Boolean.TRUE);
+
+        try {
+
+            //File signatureFile = new File("collectableSignature.xml");
+            File signatureFile = new File("threeSignerContract.xml");
+            String BaseURI = signatureFile.toURI().toURL().toString();
+
+            System.out.println("Try to verify "
+                               + signatureFile.toURI().toURL().toString());
+
+            javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+
+            db.setErrorHandler(new org.apache.xml.security.utils.IgnoreAllErrorHandler());
+
+            org.w3c.dom.Document doc =
+                db.parse(new java.io.FileInputStream(signatureFile));
+
+            XPathFactory xpf = XPathFactory.newInstance();
+            XPath xpath = xpf.newXPath();
+            xpath.setNamespaceContext(new DSNamespaceContext());
+
+            String expression = "//ds:Signature[1]";
+            NodeList signatureElems = 
+                (NodeList) xpath.evaluate(expression, doc, XPathConstants.NODESET);
+            
+            for (int i = 0; i < signatureElems.getLength(); i++) {
+                Element sigElement = (Element) signatureElems.item(i);
+                XMLSignature signature = new XMLSignature(sigElement, BaseURI);
+
+                //byte[] secretKey = "secretValue".getBytes();
+                Element keyName =
+                    (Element) sigElement.getElementsByTagNameNS(
+                        Constants.SignatureSpecNS, "KeyName").item(0);
+                String keyValue = keyName.getFirstChild().getNodeValue();
+
+                System.out.println("The signature number " + (i + 1) + " is "
+                         + (signature.checkSignatureValue(
+                         signature.createSecretKey(
+                         keyValue.getBytes())) 
+                         ? "valid (good)" : "invalid !!!!! (bad)"));
             }
-            */
-         }
-      } catch (Exception ex) {
-         ex.printStackTrace();
-      }
-   }
-
-   static {
-      org.apache.xml.security.Init.init();
-   }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
 }