Signing a Document: Step 3. Sign the Document

Document doc = getDOMDocument( /* wherever you like */ );

DOMSignContext context 
  = new DOMSignContext(entry.getPrivateKey(), doc.getDocumentElement());

XMLSignature signature = factory.newXMLSignature(signer, key);
signature.sign(context);
// The Signature element has now been added to the Document.

Previous | Next | Top | Cafe con Leche

Copyright 2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 12, 2007