本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.XMLUtils.selectDsNode方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils.selectDsNode方法的具体用法?Java XMLUtils.selectDsNode怎么用?Java XMLUtils.selectDsNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.security.utils.XMLUtils
的用法示例。
在下文中一共展示了XMLUtils.selectDsNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SignatureProperties
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Constructs {@link SignatureProperties} from {@link Element}
* @param element <code>SignatureProperties</code> element
* @param BaseURI the URI of the resource where the XML instance was stored
* @throws XMLSecurityException
*/
public SignatureProperties(Element element, String BaseURI) throws XMLSecurityException {
super(element, BaseURI);
Attr attr = element.getAttributeNodeNS(null, "Id");
if (attr != null) {
element.setIdAttributeNode(attr, true);
}
int length = getLength();
for (int i = 0; i < length; i++) {
Element propertyElem =
XMLUtils.selectDsNode(this.constructionElement, Constants._TAG_SIGNATUREPROPERTY, i);
Attr propertyAttr = propertyElem.getAttributeNodeNS(null, "Id");
if (propertyAttr != null) {
propertyElem.setIdAttributeNode(propertyAttr, true);
}
}
}
示例2: itemCRL
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemCRL
*
* @param i
* @return the X509CRL, null if not present
* @throws XMLSecurityException
*/
public XMLX509CRL itemCRL(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_X509CRL, i);
if (e != null) {
return new XMLX509CRL(e, this.baseURI);
}
return null;
}
示例3: engineLookupResolveX509Certificate
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method engineResolveX509Certificate
* @inheritDoc
* @param element
* @param BaseURI
* @param storage
*
* @throws KeyResolverException
*/
public X509Certificate engineLookupResolveX509Certificate(
Element element, String BaseURI, StorageResolver storage
) throws KeyResolverException {
try {
Element[] els =
XMLUtils.selectDsNodes(element.getFirstChild(), Constants._TAG_X509CERTIFICATE);
if ((els == null) || (els.length == 0)) {
Element el =
XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_X509DATA, 0);
if (el != null) {
return engineLookupResolveX509Certificate(el, BaseURI, storage);
}
return null;
}
// populate Object array
for (int i = 0; i < els.length; i++) {
XMLX509Certificate xmlCert = new XMLX509Certificate(els[i], BaseURI);
X509Certificate cert = xmlCert.getX509Certificate();
if (cert != null) {
return cert;
}
}
return null;
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
}
throw new KeyResolverException("generic.EmptyMessage", ex);
}
}
示例4: itemPGPData
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemPGPData
*
* @param i
* @return the asked PGPData element, null if the index is too big
* @throws XMLSecurityException
*/
public PGPData itemPGPData(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_PGPDATA, i);
if (e != null) {
return new PGPData(e, this.baseURI);
}
return null;
}
示例5: engineLookupAndResolvePublicKey
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method engineResolvePublicKey
*
* @param element
* @param BaseURI
* @param storage
* @return null if no {@link PublicKey} could be obtained
*/
public PublicKey engineLookupAndResolvePublicKey(
Element element, String BaseURI, StorageResolver storage
) {
if (element == null) {
return null;
}
Element dsaKeyElement = null;
boolean isKeyValue =
XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
if (isKeyValue) {
dsaKeyElement =
XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
} else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
// this trick is needed to allow the RetrievalMethodResolver to eat a
// ds:DSAKeyValue directly (without KeyValue)
dsaKeyElement = element;
}
if (dsaKeyElement == null) {
return null;
}
try {
DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
PublicKey pk = dsaKeyValue.getPublicKey();
return pk;
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
}
//do nothing
}
return null;
}
示例6: itemX509Data
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemX509Data
*
* @param i
* @return the asked X509Data element, null if the index is too big
* @throws XMLSecurityException
*/
public X509Data itemX509Data(int i) throws XMLSecurityException {
if (x509Datas != null) {
return x509Datas.get(i);
}
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_X509DATA, i);
if (e != null) {
return new X509Data(e, this.baseURI);
}
return null;
}
示例7: itemIssuerSerial
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemIssuerSerial
*
* @param i
* @return the X509IssuerSerial, null if not present
* @throws XMLSecurityException
*/
public XMLX509IssuerSerial itemIssuerSerial(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_X509ISSUERSERIAL, i);
if (e != null) {
return new XMLX509IssuerSerial(e, this.baseURI);
}
return null;
}
示例8: itemCertificate
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemCertificate
*
* @param i
* @return the X509Certifacte, null if not present
* @throws XMLSecurityException
*/
public XMLX509Certificate itemCertificate(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_X509CERTIFICATE, i);
if (e != null) {
return new XMLX509Certificate(e, this.baseURI);
}
return null;
}
示例9: itemKeyValue
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemKeyValue
*
* @param i
* @return the asked KeyValue element, null if the index is too big
* @throws XMLSecurityException
*/
public KeyValue itemKeyValue(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_KEYVALUE, i);
if (e != null) {
return new KeyValue(e, this.baseURI);
}
return null;
}
示例10: itemKeyName
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemKeyName
*
* @param i
* @return the asked KeyName element, null if the index is too big
* @throws XMLSecurityException
*/
public KeyName itemKeyName(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_KEYNAME, i);
if (e != null) {
return new KeyName(e, this.baseURI);
}
return null;
}
示例11: itemSubjectName
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemSubjectName
*
* @param i
* @return the X509SubjectName, null if not present
* @throws XMLSecurityException
*/
public XMLX509SubjectName itemSubjectName(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_X509SUBJECTNAME, i);
if (e != null) {
return new XMLX509SubjectName(e, this.baseURI);
}
return null;
}
示例12: item
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Return the <it>i</it><sup>th</sup> SignatureProperty. Valid <code>i</code>
* values are 0 to <code>{[email protected] getSize}-1</code>.
*
* @param i Index of the requested {@link SignatureProperty}
* @return the <it>i</it><sup>th</sup> SignatureProperty
* @throws XMLSignatureException
*/
public SignatureProperty item(int i) throws XMLSignatureException {
try {
Element propertyElem =
XMLUtils.selectDsNode(this.constructionElement, Constants._TAG_SIGNATUREPROPERTY, i);
if (propertyElem == null) {
return null;
}
return new SignatureProperty(propertyElem, this.baseURI);
} catch (XMLSecurityException ex) {
throw new XMLSignatureException("empty", ex);
}
}
示例13: itemMgmtData
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Method itemMgmtData
*
* @param i
* @return the asked MgmtData element, null if the index is too big
* @throws XMLSecurityException
*/
public MgmtData itemMgmtData(int i) throws XMLSecurityException {
Element e =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_MGMTDATA, i);
if (e != null) {
return new MgmtData(e, this.baseURI);
}
return null;
}
示例14: engineLookupAndResolvePublicKey
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/** @inheritDoc */
public PublicKey engineLookupAndResolvePublicKey(
Element element, String BaseURI, StorageResolver storage
) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName());
}
if (element == null) {
return null;
}
boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
Element rsaKeyElement = null;
if (isKeyValue) {
rsaKeyElement =
XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_RSAKEYVALUE, 0);
} else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_RSAKEYVALUE)) {
// this trick is needed to allow the RetrievalMethodResolver to eat a
// ds:RSAKeyValue directly (without KeyValue)
rsaKeyElement = element;
}
if (rsaKeyElement == null) {
return null;
}
try {
RSAKeyValue rsaKeyValue = new RSAKeyValue(rsaKeyElement, BaseURI);
return rsaKeyValue.getPublicKey();
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
}
}
return null;
}
示例15: getKeyInfo
import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
* Returns the KeyInfo child. If we are in signing mode and the KeyInfo
* does not exist yet, it is created on demand and added to the Signature.
* <br>
* This allows to add arbitrary content to the KeyInfo during signing.
*
* @return the KeyInfo object
*/
public KeyInfo getKeyInfo() {
// check to see if we are signing and if we have to create a keyinfo
if (this.state == MODE_SIGN && this.keyInfo == null) {
// create the KeyInfo
this.keyInfo = new KeyInfo(this.doc);
// get the Element from KeyInfo
Element keyInfoElement = this.keyInfo.getElement();
Element firstObject =
XMLUtils.selectDsNode(
this.constructionElement.getFirstChild(), Constants._TAG_OBJECT, 0
);
if (firstObject != null) {
// add it before the object
this.constructionElement.insertBefore(keyInfoElement, firstObject);
XMLUtils.addReturnBeforeChild(this.constructionElement, firstObject);
} else {
// add it as the last element to the signature
this.constructionElement.appendChild(keyInfoElement);
XMLUtils.addReturnToElement(this.constructionElement);
}
}
return this.keyInfo;
}