Java Code Examples for com.sun.org.apache.xml.internal.security.utils.XMLUtils#createElementInSignatureSpace()
The following examples show how to use
com.sun.org.apache.xml.internal.security.utils.XMLUtils#createElementInSignatureSpace() .
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: IntegrityHmac.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 2
Source File: SignedInfo.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Constructor SignedInfo * * @param doc <code>SignedInfo</code> is placed in this document * @param signatureMethodURI URI representation of the Digest and * Signature algorithm * @param hMACOutputLength * @param canonicalizationMethodURI URI representation of the * Canonicalization method * @throws XMLSecurityException */ public SignedInfo( Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); c14nMethod = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_CANONICALIZATIONMETHOD); c14nMethod.setAttributeNS(null, Constants._ATT_ALGORITHM, canonicalizationMethodURI); this.constructionElement.appendChild(c14nMethod); XMLUtils.addReturnToElement(this.constructionElement); if (hMACOutputLength > 0) { this.signatureAlgorithm = new SignatureAlgorithm(this.doc, signatureMethodURI, hMACOutputLength); } else { this.signatureAlgorithm = new SignatureAlgorithm(this.doc, signatureMethodURI); } signatureMethod = this.signatureAlgorithm.getElement(); this.constructionElement.appendChild(signatureMethod); XMLUtils.addReturnToElement(this.constructionElement); }
Example 3
Source File: IntegrityHmac.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 4
Source File: IntegrityHmac.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 5
Source File: IntegrityHmac.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 6
Source File: IntegrityHmac.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 7
Source File: SignedInfo.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Constructor SignedInfo * * @param doc <code>SignedInfo</code> is placed in this document * @param signatureMethodURI URI representation of the Digest and * Signature algorithm * @param hMACOutputLength * @param canonicalizationMethodURI URI representation of the * Canonicalization method * @throws XMLSecurityException */ public SignedInfo( Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); c14nMethod = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_CANONICALIZATIONMETHOD); c14nMethod.setAttributeNS(null, Constants._ATT_ALGORITHM, canonicalizationMethodURI); this.constructionElement.appendChild(c14nMethod); XMLUtils.addReturnToElement(this.constructionElement); if (hMACOutputLength > 0) { this.signatureAlgorithm = new SignatureAlgorithm(this.doc, signatureMethodURI, hMACOutputLength); } else { this.signatureAlgorithm = new SignatureAlgorithm(this.doc, signatureMethodURI); } signatureMethod = this.signatureAlgorithm.getElement(); this.constructionElement.appendChild(signatureMethod); XMLUtils.addReturnToElement(this.constructionElement); }
Example 8
Source File: IntegrityHmac.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Method engineAddContextToElement * * @param element */ public void engineAddContextToElement(Element element) { if (element == null) { throw new IllegalArgumentException("null element"); } if (this.HMACOutputLengthSet) { Document doc = element.getOwnerDocument(); Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH); Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString()); HMElem.appendChild(HMText); XMLUtils.addReturnToElement(element); element.appendChild(HMElem); XMLUtils.addReturnToElement(element); } }
Example 9
Source File: XMLSignature.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a XMLSignature in a Document * @param doc * @param baseURI * @param SignatureMethodElem * @param CanonicalizationMethodElem * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, Element SignatureMethodElem, Element CanonicalizationMethodElem ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo(this.doc, SignatureMethodElem, CanonicalizationMethodElem); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 10
Source File: Reference.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructor Reference * * @param doc the {@link Document} in which <code>XMLsignature</code> is placed * @param baseURI the URI of the resource where the XML instance will be stored * @param referenceURI URI indicate where is data which will digested * @param manifest * @param transforms {@link Transforms} applied to data * @param messageDigestAlgorithm {@link MessageDigestAlgorithm Digest algorithm} which is * applied to the data * TODO should we throw XMLSignatureException if MessageDigestAlgoURI is wrong? * @throws XMLSignatureException */ protected Reference( Document doc, String baseURI, String referenceURI, Manifest manifest, Transforms transforms, String messageDigestAlgorithm ) throws XMLSignatureException { super(doc); XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.manifest = manifest; this.setURI(referenceURI); // important: The ds:Reference must be added to the associated ds:Manifest // or ds:SignedInfo _before_ the this.resolverResult() is called. // this.manifest.appendChild(this.constructionElement); // this.manifest.appendChild(this.doc.createTextNode("\n")); if (transforms != null) { this.transforms=transforms; this.constructionElement.appendChild(transforms.getElement()); XMLUtils.addReturnToElement(this.constructionElement); } MessageDigestAlgorithm mda = MessageDigestAlgorithm.getInstance(this.doc, messageDigestAlgorithm); digestMethodElem = mda.getElement(); this.constructionElement.appendChild(digestMethodElem); XMLUtils.addReturnToElement(this.constructionElement); digestValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_DIGESTVALUE); this.constructionElement.appendChild(digestValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 11
Source File: XMLSignature.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructor XMLSignature * * @param doc * @param baseURI * @param signatureMethodURI * @param hmacOutputLength * @param canonicalizationMethodURI * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, String signatureMethodURI, int hmacOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo( this.doc, signatureMethodURI, hmacOutputLength, canonicalizationMethodURI ); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 12
Source File: XMLSignature.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructor XMLSignature * * @param doc * @param baseURI * @param signatureMethodURI * @param hmacOutputLength * @param canonicalizationMethodURI * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, String signatureMethodURI, int hmacOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo( this.doc, signatureMethodURI, hmacOutputLength, canonicalizationMethodURI ); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 13
Source File: Reference.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructor Reference * * @param doc the {@link Document} in which <code>XMLsignature</code> is placed * @param baseURI the URI of the resource where the XML instance will be stored * @param referenceURI URI indicate where is data which will digested * @param manifest * @param transforms {@link Transforms} applied to data * @param messageDigestAlgorithm {@link MessageDigestAlgorithm Digest algorithm} which is * applied to the data * TODO should we throw XMLSignatureException if MessageDigestAlgoURI is wrong? * @throws XMLSignatureException */ protected Reference( Document doc, String baseURI, String referenceURI, Manifest manifest, Transforms transforms, String messageDigestAlgorithm ) throws XMLSignatureException { super(doc); XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.manifest = manifest; this.setURI(referenceURI); // important: The ds:Reference must be added to the associated ds:Manifest // or ds:SignedInfo _before_ the this.resolverResult() is called. // this.manifest.appendChild(this.constructionElement); // this.manifest.appendChild(this.doc.createTextNode("\n")); if (transforms != null) { this.transforms=transforms; this.constructionElement.appendChild(transforms.getElement()); XMLUtils.addReturnToElement(this.constructionElement); } MessageDigestAlgorithm mda = MessageDigestAlgorithm.getInstance(this.doc, messageDigestAlgorithm); digestMethodElem = mda.getElement(); this.constructionElement.appendChild(digestMethodElem); XMLUtils.addReturnToElement(this.constructionElement); digestValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_DIGESTVALUE); this.constructionElement.appendChild(digestValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 14
Source File: XMLSignature.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructor XMLSignature * * @param doc * @param baseURI * @param signatureMethodURI * @param hmacOutputLength * @param canonicalizationMethodURI * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, String signatureMethodURI, int hmacOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo( this.doc, signatureMethodURI, hmacOutputLength, canonicalizationMethodURI ); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 15
Source File: XMLSignature.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a XMLSignature in a Document * @param doc * @param baseURI * @param SignatureMethodElem * @param CanonicalizationMethodElem * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, Element SignatureMethodElem, Element CanonicalizationMethodElem ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo(this.doc, SignatureMethodElem, CanonicalizationMethodElem); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 16
Source File: XMLSignature.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a XMLSignature in a Document * @param doc * @param baseURI * @param SignatureMethodElem * @param CanonicalizationMethodElem * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, Element SignatureMethodElem, Element CanonicalizationMethodElem ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo(this.doc, SignatureMethodElem, CanonicalizationMethodElem); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 17
Source File: Reference.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructor Reference * * @param doc the {@link Document} in which <code>XMLsignature</code> is placed * @param baseURI the URI of the resource where the XML instance will be stored * @param referenceURI URI indicate where is data which will digested * @param manifest * @param transforms {@link Transforms} applied to data * @param messageDigestAlgorithm {@link MessageDigestAlgorithm Digest algorithm} which is * applied to the data * TODO should we throw XMLSignatureException if MessageDigestAlgoURI is wrong? * @throws XMLSignatureException */ protected Reference( Document doc, String baseURI, String referenceURI, Manifest manifest, Transforms transforms, String messageDigestAlgorithm ) throws XMLSignatureException { super(doc); XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.manifest = manifest; this.setURI(referenceURI); // important: The ds:Reference must be added to the associated ds:Manifest // or ds:SignedInfo _before_ the this.resolverResult() is called. // this.manifest.appendChild(this.constructionElement); // this.manifest.appendChild(this.doc.createTextNode("\n")); if (transforms != null) { this.transforms=transforms; this.constructionElement.appendChild(transforms.getElement()); XMLUtils.addReturnToElement(this.constructionElement); } MessageDigestAlgorithm mda = MessageDigestAlgorithm.getInstance(this.doc, messageDigestAlgorithm); digestMethodElem = mda.getElement(); this.constructionElement.appendChild(digestMethodElem); XMLUtils.addReturnToElement(this.constructionElement); digestValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_DIGESTVALUE); this.constructionElement.appendChild(digestValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 18
Source File: XMLSignature.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Constructor XMLSignature * * @param doc * @param baseURI * @param signatureMethodURI * @param hmacOutputLength * @param canonicalizationMethodURI * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, String signatureMethodURI, int hmacOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo( this.doc, signatureMethodURI, hmacOutputLength, canonicalizationMethodURI ); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 19
Source File: XMLSignature.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Constructor XMLSignature * * @param doc * @param baseURI * @param signatureMethodURI * @param hmacOutputLength * @param canonicalizationMethodURI * @throws XMLSecurityException */ public XMLSignature( Document doc, String baseURI, String signatureMethodURI, int hmacOutputLength, String canonicalizationMethodURI ) throws XMLSecurityException { super(doc); String xmlnsDsPrefix = getDefaultPrefix(Constants.SignatureSpecNS); if (xmlnsDsPrefix == null || xmlnsDsPrefix.length() == 0) { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns", Constants.SignatureSpecNS ); } else { this.constructionElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + xmlnsDsPrefix, Constants.SignatureSpecNS ); } XMLUtils.addReturnToElement(this.constructionElement); this.baseURI = baseURI; this.signedInfo = new SignedInfo( this.doc, signatureMethodURI, hmacOutputLength, canonicalizationMethodURI ); this.constructionElement.appendChild(this.signedInfo.getElement()); XMLUtils.addReturnToElement(this.constructionElement); // create an empty SignatureValue; this is filled by setSignatureValueElement signatureValueElement = XMLUtils.createElementInSignatureSpace(this.doc, Constants._TAG_SIGNATUREVALUE); this.constructionElement.appendChild(signatureValueElement); XMLUtils.addReturnToElement(this.constructionElement); }
Example 20
Source File: XMLCipher.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
Element toElement() { Element result = XMLUtils.createElementInEncryptionSpace( contextDocument, EncryptionConstants._TAG_ENCRYPTIONMETHOD ); result.setAttributeNS(null, EncryptionConstants._ATT_ALGORITHM, algorithm); if (keySize > 0) { result.appendChild( XMLUtils.createElementInEncryptionSpace( contextDocument, EncryptionConstants._TAG_KEYSIZE ).appendChild(contextDocument.createTextNode(String.valueOf(keySize)))); } if (null != oaepParams) { Element oaepElement = XMLUtils.createElementInEncryptionSpace( contextDocument, EncryptionConstants._TAG_OAEPPARAMS ); oaepElement.appendChild(contextDocument.createTextNode(Base64.encode(oaepParams))); result.appendChild(oaepElement); } if (digestAlgorithm != null) { Element digestElement = XMLUtils.createElementInSignatureSpace(contextDocument, Constants._TAG_DIGESTMETHOD); digestElement.setAttributeNS(null, "Algorithm", digestAlgorithm); result.appendChild(digestElement); } if (mgfAlgorithm != null) { Element mgfElement = XMLUtils.createElementInEncryption11Space( contextDocument, EncryptionConstants._TAG_MGF ); mgfElement.setAttributeNS(null, "Algorithm", mgfAlgorithm); mgfElement.setAttributeNS( Constants.NamespaceSpecNS, "xmlns:" + ElementProxy.getDefaultPrefix(EncryptionConstants.EncryptionSpec11NS), EncryptionConstants.EncryptionSpec11NS ); result.appendChild(mgfElement); } Iterator<Element> itr = encryptionMethodInformation.iterator(); while (itr.hasNext()) { result.appendChild(itr.next()); } return result; }