Java Code Examples for com.sun.org.apache.xml.internal.security.c14n.Canonicalizer#canonicalizeSubtree()

The following examples show how to use com.sun.org.apache.xml.internal.security.c14n.Canonicalizer#canonicalizeSubtree() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignedInfo.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 2
Source File: SignedInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 3
Source File: SignedInfo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 4
Source File: SignedInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 5
Source File: SignedInfo.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 6
Source File: SignedInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 7
Source File: SignedInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 8
Source File: SignedInfo.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 9
Source File: SignedInfo.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 10
Source File: SignedInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Output the C14n stream to the given OutputStream.
 * @param os
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public void signInOctetStream(OutputStream os)
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
        c14nizer.setWriter(os);
        String inclusiveNamespaces = this.getInclusiveNamespaces();

        if (inclusiveNamespaces == null) {
            c14nizer.canonicalizeSubtree(this.constructionElement);
        } else {
            c14nizer.canonicalizeSubtree(this.constructionElement, inclusiveNamespaces);
        }
    } else {
        try {
            os.write(this.c14nizedBytes);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
Example 11
Source File: SignedInfo.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 12
Source File: SignedInfo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 13
Source File: SignedInfo.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 14
Source File: SignedInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 15
Source File: SignedInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 16
Source File: SignedInfo.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 17
Source File: SignedInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 18
Source File: SignedInfo.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Returns getCanonicalizedOctetStream
 *
 * @return the canonicalization result octet stream of <code>SignedInfo</code> element
 * @throws CanonicalizationException
 * @throws InvalidCanonicalizerException
 * @throws XMLSecurityException
 */
public byte[] getCanonicalizedOctetStream()
    throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException {
    if (this.c14nizedBytes == null) {
        Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

        this.c14nizedBytes =
            c14nizer.canonicalizeSubtree(this.constructionElement);
    }

    // make defensive copy
    return this.c14nizedBytes.clone();
}
 
Example 19
Source File: Signer.java    From IDES-Data-Preparation-Java with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
protected void updateDigestWithXmlChunk(StringBuilder parseBuf, MessageDigest messageDigest, Stack<XmlTag> stackStartTag, 
		Stack<XmlTag> stackChunkStartTag, Stack<XmlTag> stackChunkEndTag, Canonicalizer canonicalizer, DocumentBuilder docBuilderNSTrue, 
		String digestPrefixStr, String digestSuffixStr) throws Exception {
   	//stackChunkStartTag has start tags whose end tags are not in chunk
   	//stackChunkEndTag has end tags whose start tags are not in chunk
   	int startPrefixTagCount = 0, pos;
   	int startTagToAddCount = stackStartTag.size() - stackChunkStartTag.size();
   	String startPrefixTags = "", endSuffixTags = "", prefix, suffix;
   	XmlTag tag;
   	byte[] tmpbuf;
   	//add end tags, newest to oldest to match xml structure, to xml chunk for transformation
   	while (!stackChunkStartTag.empty()) {
   		//stackChunkStartTag - 0=<MessageSpec>, 1=<TAG>....add suffix </TAG></MessageSpec>
   		tag = stackChunkStartTag.pop();
   		//corresponding start tag exists in chunk
   		endSuffixTags = endSuffixTags + tag.getEndTag();
   	}
   	//add start tags, newest to oldest to match xml structure, to xml chunk for transformation
   	while (!stackChunkEndTag.empty()) {
   		//stackChunkEndTag - 0=<Address>, 1=<AddressFix>....meaning parseBuf has </AddressFix></Address>
   		//add prefix <Address><AddressFix>
   		startPrefixTagCount++;
   		tag = stackChunkEndTag.pop();
   		startPrefixTags = startPrefixTags + tag.getStartTag();
   		//corresponding end tag exists in chunk
   	}
   	//add tags, prefix and suffix, present in stackStartTag as they may have NS (namespace) defined
   	//even if a tag in stackStartTag has no NS defined, we need them because of correct transformation, mainly for 'Exclusive' transformation 
   	//stackStartTag - 0=<OUTERTAG>, 1=<MessageSpec> add prefix=<OUTERTAG><MessageSpec> and suffix=</MessageSpec></OUTERTAG>
   	prefix = suffix = "";
   	for (int i = 0; i < startTagToAddCount; i++) {
   		tag = stackStartTag.get(i);
   		//do not restrict to tags with ns only - Exclusive transformation would fail
		startPrefixTagCount++;
		prefix = prefix + tag.getStartTag();
		suffix = tag.getEndTag() + suffix;
   	}
   	startPrefixTags = prefix + startPrefixTags;
   	endSuffixTags = endSuffixTags + suffix;
   	startPrefixTags = digestPrefixStr + startPrefixTags;
   	//for prefix with digestPrefixStr
   	//<Object> and <SignatureProperty> has 1 prefix tag while <SignatureProperties><SignatureProperty> has 2
   	pos = 0;
   	while ((pos = digestPrefixStr.indexOf(">", pos + 1)) > 0)
  			startPrefixTagCount++;
   	endSuffixTags += digestSuffixStr;
   	String modifiedval = startPrefixTags + parseBuf.toString() + endSuffixTags;
	logger.trace("to transform str=" + modifiedval);
   	Document doc = docBuilderNSTrue.parse(new InputSource(new StringReader(modifiedval)));
	String digestval = new String(canonicalizer.canonicalizeSubtree(doc));
	logger.trace("transformed str=" + digestval);
	//simply drop endSuffixTags - they don't gets altered by canonicalization
	if (endSuffixTags.length() > 0)
		digestval = digestval.substring(0, digestval.length() - endSuffixTags.length());
	//drop canonicalized startPrefixTags - remember they may be altered by transformation and so use prefix count to drop them
	pos = 0;
	for (int i = 0; i < startPrefixTagCount; i++)
		pos = digestval.indexOf(">", pos + 1);
	if (pos > 0)
		digestval = digestval.substring(pos + 1);
	logger.trace("digestval=" + digestval);
	tmpbuf = digestval.getBytes();
	messageDigest.update(tmpbuf);
	if (digestBuf != null) 
		digestBuf = UtilShared.append(digestBuf, tmpbuf);
	parseBuf.setLength(0);
   	stackChunkStartTag.clear();
   	stackChunkEndTag.clear();
}
 
Example 20
Source File: XMLSigner.java    From signer with GNU Lesser General Public License v3.0 2 votes vote down vote up
public Document sign(String fileNameSource) throws Throwable{
	
	Init.init();
	
	Document doc = buildXML(fileNameSource);
					
	if(keyStore == null) {
		new Throwable("Keystore nula");
	}
	
	if(alias == null)
		alias = "";
	
	X509Certificate cert = (X509Certificate) this.keyStore.getCertificate(alias);
	PrivateKey myPrKey = (PrivateKey) keyStore.getKey (alias, null);
	
	int numSignatures = doc.getElementsByTagName("ds:Signature").getLength() - 1;
	
	Element sigTag = (Element) doc.getElementsByTagName("ds:Signature").item(numSignatures);
	
	Element objectTag = signedObject(cert, doc);
	
	Init.init();
	Canonicalizer c14n = Canonicalizer.getInstance(CanonicalizationMethod.EXCLUSIVE);
	
	byte[] canonicalized = null;
	
	if(sigPack != SignaturePack.DETACHED){
		canonicalized = c14n.canonicalizeSubtree(objectTag.getElementsByTagName("xades:SignedProperties").item(0)); 
	}else {
		canonicalized = null;
	}
	
	Element sigRefTag = createSignatureHashReference(doc, canonicalized);
	doc.getElementsByTagName("ds:SignedInfo").item(numSignatures).appendChild(sigRefTag);
	
	c14n = Canonicalizer.getInstance(CanonicalizationMethod.INCLUSIVE);
	byte[] dh = c14n.canonicalizeSubtree(doc.getElementsByTagName("ds:SignedInfo").item(numSignatures));
	
	Signature sig = Signature.getInstance("SHA256withRSA");
	sig.initSign(myPrKey);
	sig.update(dh);
	byte[] s = sig.sign();
	
	Element signValueTag = doc.createElementNS(XMLNS, "ds:SignatureValue");
	signValueTag.setAttribute("Id", "value-"+id);
	String hash = Base64.toBase64String(s);
	String result = splitString(hash);
	
	signValueTag.setTextContent(result);
	sigTag.appendChild(signValueTag);
	
	
	Element keyInfo = doc.createElementNS(XMLNS, "ds:KeyInfo");
	doc.getElementsByTagName("ds:Signature").item(numSignatures).appendChild(keyInfo);
	
	Element x509 = doc.createElementNS(XMLNS, "ds:X509Data");
	keyInfo.appendChild(x509);
			
	Element x509Certificate = doc.createElementNS(XMLNS, "ds:X509Certificate");
	x509Certificate.setTextContent(splitString(Base64.toBase64String(cert.getEncoded())));
	x509.appendChild(x509Certificate );
	
	sigTag.appendChild(objectTag);
	
	signedDocument = doc;
	
	return doc;
}