public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element pdElem = DOMUtils.createElement(ownerDoc, "PGPData", XMLSignature.XMLNS, dsPrefix); // create and append PGPKeyID element if (keyId != null) { Element keyIdElem = DOMUtils.createElement(ownerDoc, "PGPKeyID", XMLSignature.XMLNS, dsPrefix); keyIdElem.appendChild(ownerDoc.createTextNode(Base64.encode(keyId))); pdElem.appendChild(keyIdElem); } // create and append PGPKeyPacket element if (keyPacket != null) { Element keyPktElem = DOMUtils.createElement(ownerDoc, "PGPKeyPacket", XMLSignature.XMLNS, dsPrefix); keyPktElem.appendChild(ownerDoc.createTextNode(Base64.encode(keyPacket))); pdElem.appendChild(keyPktElem); } // create and append any elements for (int i = 0, size = externalElements.size(); i < size; i++) { DOMUtils.appendChild( pdElem, ((javax.xml.crypto.dom.DOMStructure) externalElements.get(i)).getNode()); } parent.appendChild(pdElem); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Marshalling Reference"); } Document ownerDoc = DOMUtils.getOwnerDocument(parent); refElem = DOMUtils.createElement(ownerDoc, "Reference", XMLSignature.XMLNS, dsPrefix); // set attributes DOMUtils.setAttributeID(refElem, "Id", id); DOMUtils.setAttribute(refElem, "URI", uri); DOMUtils.setAttribute(refElem, "Type", type); // create and append Transforms element if (!transforms.isEmpty() || !appliedTransforms.isEmpty()) { Element transformsElem = DOMUtils.createElement(ownerDoc, "Transforms", XMLSignature.XMLNS, dsPrefix); refElem.appendChild(transformsElem); for (int i = 0, size = appliedTransforms.size(); i < size; i++) { DOMStructure transform = (DOMStructure) appliedTransforms.get(i); transform.marshal(transformsElem, dsPrefix, context); } for (int i = 0, size = transforms.size(); i < size; i++) { DOMStructure transform = (DOMStructure) transforms.get(i); transform.marshal(transformsElem, dsPrefix, context); } } // create and append DigestMethod element ((DOMDigestMethod) digestMethod).marshal(refElem, dsPrefix, context); // create and append DigestValue element if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Adding digestValueElem"); } Element digestValueElem = DOMUtils.createElement(ownerDoc, "DigestValue", XMLSignature.XMLNS, dsPrefix); if (digestValue != null) { digestValueElem.appendChild(ownerDoc.createTextNode(Base64.encode(digestValue))); } refElem.appendChild(digestValueElem); parent.appendChild(refElem); here = refElem.getAttributeNodeNS(null, "URI"); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element propElem = DOMUtils.createElement(ownerDoc, "SignatureProperty", XMLSignature.XMLNS, dsPrefix); // set attributes DOMUtils.setAttributeID(propElem, "Id", id); DOMUtils.setAttribute(propElem, "Target", target); // create and append any elements and mixed content for (int i = 0, size = content.size(); i < size; i++) { javax.xml.crypto.dom.DOMStructure property = (javax.xml.crypto.dom.DOMStructure) content.get(i); DOMUtils.appendChild(propElem, property.getNode()); } parent.appendChild(propElem); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element objElem = DOMUtils.createElement(ownerDoc, "Object", XMLSignature.XMLNS, dsPrefix); // set attributes DOMUtils.setAttributeID(objElem, "Id", id); DOMUtils.setAttribute(objElem, "MimeType", mimeType); DOMUtils.setAttribute(objElem, "Encoding", encoding); // create and append any elements and mixed content, if necessary for (int i = 0, size = content.size(); i < size; i++) { XMLStructure object = (XMLStructure) content.get(i); if (object instanceof DOMStructure) { ((DOMStructure) object).marshal(objElem, dsPrefix, context); } else { javax.xml.crypto.dom.DOMStructure domObject = (javax.xml.crypto.dom.DOMStructure) object; DOMUtils.appendChild(objElem, domObject.getNode()); } } parent.appendChild(objElem); }