本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.XMLUtils.createElementInSignatureSpace方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils.createElementInSignatureSpace方法的具体用法?Java XMLUtils.createElementInSignatureSpace怎么用?Java XMLUtils.createElementInSignatureSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.security.utils.XMLUtils
的用法示例。
在下文中一共展示了XMLUtils.createElementInSignatureSpace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SignedInfo
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* 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);
}
示例2: engineAddContextToElement
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* 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);
}
}
示例3: Reference
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* 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);
}
示例4: XMLSignature
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* 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);
}
示例5: toElement
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
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;
}