: new DOMSignContext(key, n, nextSibling); for (Map.Entry<String,String> me : signatureConfig.getNamespacePrefixes().entrySet()) { domSignContext.putNamespacePrefix(me.getKey(), me.getValue());
xmlSignContext.putNamespacePrefix(me.getKey(), me.getValue());
public static void signDOM(Node node, PrivateKey privateKey, Certificate origCert) { XMLSignatureFactory fac = initXMLSigFactory(); X509Certificate cert = (X509Certificate) origCert; // Create the KeyInfo containing the X509Data. KeyInfoFactory kif = fac.getKeyInfoFactory(); List<Object> x509Content = new ArrayList<Object>(); x509Content.add(cert.getSubjectX500Principal().getName()); x509Content.add(cert); X509Data xd = kif.newX509Data(x509Content); KeyInfo ki = kif.newKeyInfo(Collections.singletonList(xd)); // Create a DOMSignContext and specify the RSA PrivateKey and // location of the resulting XMLSignature's parent element. DOMSignContext dsc = new DOMSignContext(privateKey, node); dsc.putNamespacePrefix("http://www.w3.org/2000/09/xmldsig#", "ns2"); // Create the XMLSignature, but don't sign it yet. try { SignedInfo si = initSignedInfo(fac); XMLSignature signature = fac.newXMLSignature(si, ki); // Marshal, generate, and sign the enveloped signature. signature.sign(dsc); } catch (Exception e) { throw new RuntimeException(e); } }
dsc.putNamespacePrefix(XML_DIGSIG_NS, "ns2");
: new DOMSignContext(key, n, nextSibling); for (Map.Entry<String,String> me : signatureConfig.getNamespacePrefixes().entrySet()) { domSignContext.putNamespacePrefix(me.getKey(), me.getValue());
signContext.putNamespacePrefix(XMLConstants.DSIGNNS, xmlSignaturePrefix); try {
); signContext.putNamespacePrefix(XMLConstants.DSIGNNS, xmlSignaturePrefix);
key, docSignature.getDocumentElement() ); signContext.putNamespacePrefix(XMLConstants.DSIGNNS, xmlSignaturePrefix);
signContext.putNamespacePrefix(XMLSignature.XMLNS, xmlSignaturePrefix); signContext.putNamespacePrefix(xadesNamespace, xadesPrefix);
dsc.putNamespacePrefix("http://www.w3.org/2000/09/xmldsig#", "ds");
dsc.putNamespacePrefix("http://www.w3.org/2000/09/xmldsig#", "ds");
dsc.putNamespacePrefix ("http://www.w3.org/2000/09/xmldsig#", "ds");
this.signContext.putNamespacePrefix(XMLSignature.XMLNS, this.xades.getXmlSignaturePrefix()); this.signContext.putNamespacePrefix(this.xadesNamespace, this.xades.getXadesPrefix());
xmlSignContext.putNamespacePrefix(me.getKey(), me.getValue());
this.baseElement != null ? this.baseElement : getBaseDocument() ); this.signContext.putNamespacePrefix(XMLSignature.XMLNS, this.xades.getXmlSignaturePrefix()); this.signContext.putNamespacePrefix(this.xadesNamespace, this.xades.getXadesPrefix()); this.signContext.setURIDereferencer(new OOXMLURIDereferencer(this.ooXmlDocument));
dsc.putNamespacePrefix("http://www.w3.org/2000/09/xmldsig#", "ds");
dsc.putNamespacePrefix ("http://www.w3.org/2000/09/xmldsig#", "ds");
dsc.putNamespacePrefix("http://www.w3.org/2000/09/xmldsig#", "ds");
XMLSignature signature = dsigHelper.constructSignature(signedInfo, keyInfo, signaturePolicy.getUUID()); signContext.put(MessageConstants.WSS_PROCESSING_CONTEXT, context); signContext.putNamespacePrefix(MessageConstants.DSIG_NS, MessageConstants.DSIG_PREFIX);