/** * This method invokes the {@link #marshalParams marshalParams} * method to marshal any algorithm-specific parameters. */ public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element smElem = DOMUtils.createElement(ownerDoc, "SignatureMethod", XMLSignature.XMLNS, dsPrefix); DOMUtils.setAttribute(smElem, "Algorithm", getAlgorithm()); if (getParameterSpec() != null) { marshalParams(smElem, dsPrefix); } parent.appendChild(smElem); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { ownerDoc = DOMUtils.getOwnerDocument(parent); Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo", XMLSignature.XMLNS, dsPrefix); // create and append CanonicalizationMethod element DOMCanonicalizationMethod dcm = (DOMCanonicalizationMethod)canonicalizationMethod; dcm.marshal(siElem, dsPrefix, context); // create and append SignatureMethod element ((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context); // create and append Reference elements for (Reference reference : references) { ((DOMReference)reference).marshal(siElem, dsPrefix, context); } // append Id attribute DOMUtils.setAttributeID(siElem, "Id", id); parent.appendChild(siElem); localSiElem = siElem; }
public void init(XMLStructure parent, XMLCryptoContext context) throws InvalidAlgorithmParameterException { if (context != null && !(context instanceof DOMCryptoContext)) { throw new ClassCastException ("context must be of type DOMCryptoContext"); } if (parent == null) { throw new NullPointerException(); } if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) ((javax.xml.crypto.dom.DOMStructure) parent).getNode(); ownerDoc = DOMUtils.getOwnerDocument(transformElem); }
public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException { if (context != null && !(context instanceof DOMCryptoContext)) { throw new ClassCastException ("context must be of type DOMCryptoContext"); } if (parent == null) { throw new NullPointerException(); } if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) ((javax.xml.crypto.dom.DOMStructure) parent).getNode(); ownerDoc = DOMUtils.getOwnerDocument(transformElem); }
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 (XMLStructure property : content) { DOMUtils.appendChild(propElem, ((javax.xml.crypto.dom.DOMStructure)property).getNode()); } parent.appendChild(propElem); }
/** * This method invokes the abstract {@link #marshalParams marshalParams} * method to marshal any algorithm-specific parameters. */ public void marshal(Node parent, String prefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element dmElem = DOMUtils.createElement(ownerDoc, "DigestMethod", XMLSignature.XMLNS, prefix); DOMUtils.setAttribute(dmElem, "Algorithm", getAlgorithm()); if (params != null) { marshalParams(dmElem, prefix); } parent.appendChild(dmElem); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element propsElem = DOMUtils.createElement(ownerDoc, "SignatureProperties", XMLSignature.XMLNS, dsPrefix); // set attributes DOMUtils.setAttributeID(propsElem, "Id", id); // create and append any properties for (SignatureProperty property : properties) { ((DOMSignatureProperty)property).marshal(propsElem, dsPrefix, context); } parent.appendChild(propsElem); }
public void init(XMLStructure parent, XMLCryptoContext context) throws InvalidAlgorithmParameterException { if (context != null && !(context instanceof DOMCryptoContext)) { throw new ClassCastException ("context must be of type DOMCryptoContext"); } if (parent == null) { throw new NullPointerException(); } if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) ((javax.xml.crypto.dom.DOMStructure)parent).getNode(); ownerDoc = DOMUtils.getOwnerDocument(transformElem); }
public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException { if (context != null && !(context instanceof DOMCryptoContext)) { throw new ClassCastException ("context must be of type DOMCryptoContext"); } if (parent == null) { throw new NullPointerException(); } if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) ((javax.xml.crypto.dom.DOMStructure)parent).getNode(); ownerDoc = DOMUtils.getOwnerDocument(transformElem); }
/** * This method invokes the abstract {@link #marshalParams marshalParams} * method to marshal any algorithm-specific parameters. */ public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element transformElem = null; if (parent.getLocalName().equals("Transforms")) { transformElem = DOMUtils.createElement(ownerDoc, "Transform", XMLSignature.XMLNS, dsPrefix); } else { transformElem = DOMUtils.createElement(ownerDoc, "CanonicalizationMethod", XMLSignature.XMLNS, dsPrefix); } DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm()); spi.marshalParams(new javax.xml.crypto.dom.DOMStructure(transformElem), context); parent.appendChild(transformElem); }
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException { Document ownerDoc = DOMUtils.getOwnerDocument(parent); Element isElem = DOMUtils.createElement(ownerDoc, "X509IssuerSerial", XMLSignature.XMLNS, dsPrefix); Element inElem = DOMUtils.createElement(ownerDoc, "X509IssuerName", XMLSignature.XMLNS, dsPrefix); Element snElem = DOMUtils.createElement(ownerDoc, "X509SerialNumber", XMLSignature.XMLNS, dsPrefix); inElem.appendChild(ownerDoc.createTextNode(issuerName)); snElem.appendChild(ownerDoc.createTextNode(serialNumber.toString())); isElem.appendChild(inElem); isElem.appendChild(snElem); parent.appendChild(isElem); }
void marshalPublicKey(Node parent, Document doc, String dsPrefix, DOMCryptoContext context) throws MarshalException { Element rsaElem = DOMUtils.createElement(doc, "RSAKeyValue", XMLSignature.XMLNS, dsPrefix); Element modulusElem = DOMUtils.createElement(doc, "Modulus", XMLSignature.XMLNS, dsPrefix); Element exponentElem = DOMUtils.createElement(doc, "Exponent", XMLSignature.XMLNS, dsPrefix); modulus.marshal(modulusElem, dsPrefix, context); exponent.marshal(exponentElem, dsPrefix, context); rsaElem.appendChild(modulusElem); rsaElem.appendChild(exponentElem); parent.appendChild(rsaElem); }
void marshalPublicKey(Node parent, Document doc, String dsPrefix, DOMCryptoContext context) throws MarshalException { Element dsaElem = DOMUtils.createElement(doc, "DSAKeyValue", XMLSignature.XMLNS, dsPrefix); // parameters J, Seed & PgenCounter are not included Element pElem = DOMUtils.createElement(doc, "P", XMLSignature.XMLNS, dsPrefix); Element qElem = DOMUtils.createElement(doc, "Q", XMLSignature.XMLNS, dsPrefix); Element gElem = DOMUtils.createElement(doc, "G", XMLSignature.XMLNS, dsPrefix); Element yElem = DOMUtils.createElement(doc, "Y", XMLSignature.XMLNS, dsPrefix); p.marshal(pElem, dsPrefix, context); q.marshal(qElem, dsPrefix, context); g.marshal(gElem, dsPrefix, context); y.marshal(yElem, dsPrefix, context); dsaElem.appendChild(pElem); dsaElem.appendChild(qElem); dsaElem.appendChild(gElem); dsaElem.appendChild(yElem); parent.appendChild(dsaElem); }