You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2005/07/05 13:54:32 UTC

cvs commit: xml-security/c/src/tools/xtest xtest.cpp

blautenb    2005/07/05 04:54:32

  Modified:    c/src/tools/xtest xtest.cpp
  Log:
  Use new URI based signature creation methods
  
  Revision  Changes    Path
  1.54      +51 -26    xml-security/c/src/tools/xtest/xtest.cpp
  
  Index: xtest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/xtest/xtest.cpp,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- xtest.cpp	22 May 2005 02:40:07 -0000	1.53
  +++ xtest.cpp	5 Jul 2005 11:54:32 -0000	1.54
  @@ -548,7 +548,9 @@
   		sig->setDSIGNSPrefix(MAKE_UNICODE_STRING("ds"));
   		sig->setPrettyPrint(true);
   
  -		sigNode = sig->createBlankSignature(doc, CANON_C14N_COM, SIGNATURE_HMAC, HASH_SHA1);
  +		sigNode = sig->createBlankSignature(doc, 
  +			DSIGConstants::s_unicodeStrURIC14N_COM,
  +			DSIGConstants::s_unicodeStrURIHMAC_SHA1);
   
   		doc->appendChild(sigNode);
   
  @@ -561,7 +563,8 @@
   		obj->appendChild(txt);
   
   		// Add a Reference
  -		sig->createReference(MAKE_UNICODE_STRING("#ObjectId"));
  +		sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), 
  +			DSIGConstants::s_unicodeStrURISHA1);
   
   		// Get a key
   		cerr << "signing ... ";
  @@ -656,7 +659,9 @@
   #if defined (XSEC_XERCES_HAS_SETIDATTRIBUTE)
   		sig->setIdByAttributeName(false);		// Do not search by name
   #endif
  -		sigNode = sig->createBlankSignature(doc, CANON_C14N_COM, SIGNATURE_HMAC, HASH_SHA1);
  +		sigNode = sig->createBlankSignature(doc, 
  +			DSIGConstants::s_unicodeStrURIC14N_COM,
  +			DSIGConstants::s_unicodeStrURIHMAC_SHA1);
   
   		doc->appendChild(sigNode);
   
  @@ -669,7 +674,8 @@
   		obj->appendChild(txt);
   
   		// Add a Reference
  -		DSIGReference * ref = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"));
  +		DSIGReference * ref = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		// Add a Base64 transform
   		ref->appendBase64Transform();
   
  @@ -766,7 +772,9 @@
   		sig->setDSIGNSPrefix(MAKE_UNICODE_STRING("ds"));
   		sig->setPrettyPrint(true);
   
  -		sigNode = sig->createBlankSignature(doc, CANON_C14N_COM, SIGNATURE_HMAC, HASH_SHA512);
  +		sigNode = sig->createBlankSignature(doc, 
  +			DSIGConstants::s_unicodeStrURIC14N_COM,
  +			DSIGConstants::s_unicodeStrURIHMAC_SHA512);
   
   		doc->appendChild(sigNode);
   
  @@ -780,13 +788,17 @@
   
   		// Add a Reference
   		cerr << "224 ... ";
  -		ref[0] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), HASH_SHA224);
  +		ref[0] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), 
  +			DSIGConstants::s_unicodeStrURISHA224);
   		cerr << "256 ... ";
  -		ref[1] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), HASH_SHA256);
  +		ref[1] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), 
  +			DSIGConstants::s_unicodeStrURISHA256);
   		cerr << "384 ... ";
  -		ref[2] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), HASH_SHA384);
  +		ref[2] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"),
  +			DSIGConstants::s_unicodeStrURISHA384);
   		cerr << "512 ... ";
  -		ref[3] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"), HASH_SHA512);
  +		ref[3] = sig->createReference(MAKE_UNICODE_STRING("#ObjectId"),
  +			DSIGConstants::s_unicodeStrURISHA512);
   
   		// Get a key
   		cerr << "signing ... ";
  @@ -950,7 +962,9 @@
   		sig->setDSIGNSPrefix(MAKE_UNICODE_STRING("ds"));
   		sig->setPrettyPrint(true);
   
  -		sigNode = sig->createBlankSignature(doc, CANON_C14N_COM, SIGNATURE_HMAC, HASH_SHA1);
  +		sigNode = sig->createBlankSignature(doc, 
  +			DSIGConstants::s_unicodeStrURIC14N_COM,
  +			DSIGConstants::s_unicodeStrURIHMAC_SHA1);
   		DOMElement * rootElem = doc->getDocumentElement();
   		DOMNode * prodElem = rootElem->getFirstChild();
   
  @@ -963,34 +977,43 @@
   		 * Add some test references
   		 */
   
  -		ref[0] = sig->createReference(MAKE_UNICODE_STRING(""));
  +		ref[0] = sig->createReference(MAKE_UNICODE_STRING(""),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[0]->appendEnvelopedSignatureTransform();
   
  -		ref[1] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[1] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[1]->appendEnvelopedSignatureTransform();
  -		ref[1]->appendCanonicalizationTransform(CANON_C14N_NOC);
  +		ref[1]->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIC14N_NOC);
   
  -		ref[2] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[2] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[2]->appendEnvelopedSignatureTransform();
  -		ref[2]->appendCanonicalizationTransform(CANON_C14N_COM);
  +		ref[2]->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIC14N_COM);
   
  -		ref[3] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[3] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[3]->appendEnvelopedSignatureTransform();
  -		ref[3]->appendCanonicalizationTransform(CANON_C14NE_NOC);
  +		ref[3]->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_NOC);
   
  -		ref[4] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[4] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[4]->appendEnvelopedSignatureTransform();
  -		ref[4]->appendCanonicalizationTransform(CANON_C14NE_COM);
  +		ref[4]->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
   
  -		ref[5] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[5] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[5]->appendEnvelopedSignatureTransform();
  -		DSIGTransformC14n * ce = ref[5]->appendCanonicalizationTransform(CANON_C14NE_COM);
  +		DSIGTransformC14n * ce = ref[5]->appendCanonicalizationTransform(
  +			DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
   		ce->addInclusiveNamespace("foo");
   
   		sig->setECNSPrefix(MAKE_UNICODE_STRING("ec"));
  -		ref[6] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"));
  +		ref[6] = sig->createReference(MAKE_UNICODE_STRING("#xpointer(/)"),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		ref[6]->appendEnvelopedSignatureTransform();
  -		ce = ref[6]->appendCanonicalizationTransform(CANON_C14NE_COM);
  +		ce = ref[6]->appendCanonicalizationTransform(
  +			DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
   		ce->addInclusiveNamespace("foo");
   
   #ifdef XSEC_NO_XALAN
  @@ -1004,12 +1027,14 @@
   		 */
   
   
  -		ref[7] = sig->createReference(MAKE_UNICODE_STRING(""));
  +		ref[7] = sig->createReference(MAKE_UNICODE_STRING(""),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		sig->setXPFNSPrefix(MAKE_UNICODE_STRING("xpf"));
   		DSIGTransformXPathFilter * xpf = ref[7]->appendXPathFilterTransform();
   		xpf->appendFilter(FILTER_INTERSECT, MAKE_UNICODE_STRING("//ADoc/category"));
   
  -		ref[8] = sig->createReference(MAKE_UNICODE_STRING(""));
  +		ref[8] = sig->createReference(MAKE_UNICODE_STRING(""),
  +			DSIGConstants::s_unicodeStrURISHA1);
   		/*		ref[5]->appendXPathTransform("ancestor-or-self::dsig:Signature", 
   				"xmlns:dsig=http://www.w3.org/2000/09/xmldsig#"); */