santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Luc Cooke <jlco...@certainkey.com>
Subject dropping in XML
Date Thu, 31 Aug 2006 19:13:25 GMT
Greetings,

Wanted how to do this (if it's possible with apache xmlsec, or even allowed
by the standard).

I want to insert "rec.xml" into "doc.xml" as you see attached here and sign
the whole thing.

Trying to fight with appendChild() and DocumentBuilder.parse() keeps getting
me exceptions saying I can't insert a node into something that not from the
same Document.

Help would be great.  As I start learning this tool.

JLC

### BEGIN doc.xml ###
<?xml version="1.0" encoding="UTF-8"?>
<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="PostMarkedReceiptSignature">
  <dsig:SignedInfo>
    <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
    <dsig:Reference URI="#TstInfo">
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
      <dsig:DigestValue>0LgZjdD0UGrR4RX0egka1UAtWVU=</dsig:DigestValue>
    </dsig:Reference>
    <dsig:Reference URI="#Receipt">
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
      <dsig:DigestValue>JDK2kPGna71ehS5PCQJ3iRTN8gk=</dsig:DigestValue>
    </dsig:Reference>
    <dsig:Reference URI="#PostMarkedSignatures">
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
      <dsig:DigestValue>l0RHNPcNw4SReaad2IMP/SexxMc=</dsig:DigestValue>
    </dsig:Reference>
  </dsig:SignedInfo>
  <dsig:SignatureValue>1jnzbouFs1vi3/X1NraNNthG/UgM9XvnZWTS7WYS51Zt/Y8Jvta1h+wW2R7BDeHt
XMSb6w08oZCfwpQ8gzTVujg+JFmz4LwjEiLHn6zXVnlv3QK1HnFX3aIRjWDpmPNT
hPal1XKzpmJfAeFvun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EFCs6yi4oBFWYGSCLY
+4lb0PrEMB8GA1UdIwQYMBaAFO0VydJTZFy9p5n9OT6icSir2KhQMC4GA1UdHwQn
MCUwI6AhoB+GHWh0dHA6Ly9jYTEudXB1LmludC9tYXN0ZXIuY3JsMAsGA1UdDwQE
AwIGwDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDCDANBgkqhkiG9w0BAQUFAAOCAQEA
EiPjbN4zcLPOztr9WLSVB3C+e+qdl1xdzO9xu4tgtiXmeu6liSicWnRv8VNHJLyx
acSjCHM5rvn+ItVRCKcQf5l6aXab4XaIJFHCqjW6m09v0T0CNRawQaMYTx83iAcA
jot4dQ11kca4sL3nYIrxiBMPjwRjsLS/UvogLWjmwwx07lFrat5vLwGYPTjmxGyI
vngOIpc7Deg1xKhBXK4pBof4l0gukhZ0p98Xq181QcW2C/453kGCA307GY2+bsEe
9BvnoWPKk+udtb2+NHKgiFmh0arupWd0YI/szP2Zdim5XyVnXV+UuKW8Wi/83TBB
b2u1v4jWQWzHV/WfjdX2lg==</dsig:X509Certificate>
<dsig:X509SubjectName>emailAddress=CAAdmin@upu.int,CN=Universal Postal Union Pilot EPM
Timestamp,OU=Electronic Post Mark,O=For Test Use Only,O=Universal Postal Union,L=Berne,ST=Berne,C=CH</dsig:X509SubjectName>
<dsig:X509IssuerSerial>
<dsig:X509IssuerName>emailAddress=CAAdmin@upu.int,CN=Universal Postal Union Pilot EPM
Authority,OU=Electronic Post Mark,O=For Test Use Only,O=Universal Postal Union,L=Berne,ST=Berne,C=CH</dsig:X509IssuerName>
<dsig:X509SerialNumber>4</dsig:X509SerialNumber>
</dsig:X509IssuerSerial>
</dsig:X509Data>
  </dsig:KeyInfo>
  <dsig:Object xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="TstInfo">
    <dss:TstInfo xmlns:dss="urn:oasis:names:tc:dss:1.0:core:schema">
      <SerialNumber>100000002276</SerialNumber>
      <CreationTime>2006-8-31T11:45:41.187</CreationTime>
      <Policy/>
      <ErrorBound/>
      <Ordered/>
      <TSA>EMAIL=CAAdmin@upu.int, CN=Universal Postal Union Pilot EPM Timestamp, OU=Electronic
Post Mark, O=For Test Use Only, O=Universal Postal Union, L=Berne, S=Berne, C=CH</TSA>
    </dss:TstInfo>
  </dsig:Object>
  <dsig:Object xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="Receipt">
    <epm:PostMarkedReceipt xmlns:epm="http://www.upu.int/EPMService/schemas">
    <Receipt><TransactionKey><Locator><CountryCode>CA</CountryCode><Version>UPU115</Version><ServiceProvider/><Environment/></Locator><Key>G9Z8-BCIH</Key><Sequence>1</Sequence></TransactionKey><tsaX509SubjectName>C=CH,ST=Berne,L=Berne,O=Universal
Postal Union,O=For Test Use Only,OU=Electronic Post Mark,CN=Universal Postal Union Pilot EPM
Timestamp,E=CAAdmin@upu.int</tsaX509SubjectName><TimeStampValue>20060831154541Z</TimeStampValue><TimeStampToken>MIAGCSqGSIb3DQEHAqCAMIIHwgIBATELMAkGBSsOAwIaBQAwggFaBgsqhkiG9w0B
CRABBKCCAUkEggFFMIIBQQIBAQYDKgMEMCEwCQYFKw4DAhoFAAQUX7UNHurs04D4
Splu5GvsIlsAiOMCAQ8YDzIwMDYwODMxMTU0NTQxWjADAgEBAQH/AhEAxHUESttX
Ux1ficv0xsRX+aCB5KSB4TCB3jELMAkGA1UEBhMCQ0gxDjAMBgNVBAgTBUJlcm5l
MQ4wDAYDVQQHEwVCZXJuZTEfMB0GA1UEChMWVW5pdmVyc2FsIFBvc3RhbCBVbmlv
bjEaMBgGA1UEChMRRm9yIFRlc3QgVXNlIE9ubHkxHTAbBgNVBAsTFEVsZWN0cm9u
aWMgUG9zdCBNYXJrMTMwMQYDVQQDEypVbml2ZXJzYWwgUG9zdGFsIFVuaW9uIFBp
bG90IEVQTSBUaW1lc3RhbXAxHjAcBgkqhkiG9w0BCQEWD0NBQWRtaW5AdXB1Lmlu
dKCCBGAwggRcMIIDRKADAgECAgEEMA0GCSqGSIb3DQ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CE+XohIZkkY2lcBZwHSLBa8C5UEgiahbBXzOnwAAAAA=</TimeStampToken><RevocationStatusQualifier>Not
Applicable</RevocationStatusQualifier><ClientApplication><NameAndVersion>TestDriver
Data Preparation</NameAndVersion><ContentTransformScheme>none</ContentTransformScheme></ClientApplication></Receipt></epm:PostMarkedReceipt>
  </dsig:Object>
  <dsig:Object xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="PostMarkedSignatures">
    <epm:PostMarkedContent xmlns:epm="http://www.upu.int/EPMService/schemas">
      <PostMarkedSignatureValue>UQ+A58r21hXmBxhVAXkIKk6nRLIKPfldDfR6DfoeHFCX3mfzpTRRUiVSmj6Bb93P
5yeKtqrnj73Ho0vOVoe323j/ksfvMUrwE6mpt4z52zmAoneszFdb+EgwdiGVE0z6
K6UGu7H9QwnCqB5nD80vTGyLSl5OAUsanzunObeQmnk=</PostMarkedSignatureValue>
    </epm:PostMarkedContent>
  </dsig:Object>
</dsig:Signature>
### END doc.xml ###

### BEGIN rec.xml ###
    <Receipt><TransactionKey><Locator><CountryCode>CA</CountryCode><Version>UPU115</Version><ServiceProvider/><Environment/></Locator><Key>G9Z8-BCIH</Key><Sequence>1</Sequence></TransactionKey><tsaX509SubjectName>C=CH,ST=Berne,L=Berne,O=Universal
Postal Union,O=For Test Use Only,OU=Electronic Post Mark,CN=Universal Postal Union Pilot EPM
Timestamp,E=CAAdmin@upu.int</tsaX509SubjectName><TimeStampValue>20060831154541Z</TimeStampValue><TimeStampToken>MIAGCSqGSIb3DQEHAqCAMIIHwgIBATELMAkGBSsOAwIaBQAwggFaBgsqhkiG9w0B
CRABBKCCAUkEggFFMIIBQQIBAQYDKgMEMCEwCQYFKw4DAhoFAAQUX7UNHurs04D4
Splu5GvsIlsAiOMCAQ8YDzIwMDYwODMxMTU0NTQxWjADAgEBAQH/AhEAxHUESttX
Ux1ficv0xsRX+aCB5KSB4TCB3jELMAkGA1UEBhMCQ0gxDjAMBgNVBAgTBUJlcm5l
MQ4wDAY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4DAhoFAKBfMBoGCSqGSIb3DQEJ
AzENBgsqhkiG9w0BCRABBDAcBgkqhkiG9w0BCQUxDxcNMDYwODMxMTU0NTQxWjAj
BgkqhkiG9w0BCQQxFgQU3LFFDRM/w4kB+yL9K7FU4tS/VO0wDQYJKoZIhvcNAQEB
BQAEgYA/jTGI0m5QRZzZBob73YnAAsJ8kit/s7ulXpkNSwgthqxf+cOw9ZUeWtgw
I4dN7vTBHN/hRPJ3bgND6OO11o3pmotHYAHxejUMxXjPev4UcwX763bdb+rhJH5C
zBLRzWGYrdBSCE+XohIZkkY2lcBZwHSLBa8C5UEgiahbBXzOnwAAAAA=</TimeStampToken><RevocationStatusQualifier>Not
Applicable</RevocationStatusQualifier><ClientApplication><NameAndVersion>TestDriver
Data Preparation</NameAndVersion><ContentTransformScheme>none</ContentTransformScheme></ClientApplication></Receipt>
### END rec.xml ###

Mime
View raw message