gpt4 book ai didi

javax.xml.crypto.dsig.XMLObject类的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 06:17:05 27 4
gpt4 key购买 nike

本文整理了Java中javax.xml.crypto.dsig.XMLObject类的一些代码示例,展示了XMLObject类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLObject类的具体详情如下:
包路径:javax.xml.crypto.dsig.XMLObject
类名称:XMLObject

XMLObject介绍

[英]A representation of the XML Object element as defined in the W3C Recommendation for XML-Signature Syntax and Processing. An XMLObject may contain any data and may include optional MIME type, ID, and encoding attributes. The XML Schema Definition is defined as:

<element name="Object" type="ds:ObjectType"/>  
<complexType name="ObjectType" mixed="true"> 
<sequence minOccurs="0" maxOccurs="unbounded"> 
<any namespace="##any" processContents="lax"/> 
</sequence> 
<attribute name="Id" type="ID" use="optional"/>  
<attribute name="MimeType" type="string" use="optional"/> 
<attribute name="Encoding" type="anyURI" use="optional"/>  
</complexType>

A XMLObject instance may be created by invoking the XMLSignatureFactory#newXMLObject method of the XMLSignatureFactory class; for example:

XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); 
List content = Collections.singletonList(fac.newManifest(references))); 
XMLObject object = factory.newXMLObject(content, "object-1", null, null);

Note that this class is named XMLObject rather than Object to avoid naming clashes with the existing java.lang.Object class.
[中]在W3C Recommendation for XML-Signature Syntax and Processing中定义的XMLObject元素的表示形式。XMLObject可以包含任何数据,还可以包括可选的MIME类型、ID和编码属性。XML模式定义为:

<element name="Object" type="ds:ObjectType"/>  
<complexType name="ObjectType" mixed="true"> 
<sequence minOccurs="0" maxOccurs="unbounded"> 
<any namespace="##any" processContents="lax"/> 
</sequence> 
<attribute name="Id" type="ID" use="optional"/>  
<attribute name="MimeType" type="string" use="optional"/> 
<attribute name="Encoding" type="anyURI" use="optional"/>  
</complexType>

可以通过调用XMLSignatureFactory类的XMLSignatureFactory#newXMLObject方法创建XMLObject实例;例如:

XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); 
List content = Collections.singletonList(fac.newManifest(references))); 
XMLObject object = factory.newXMLObject(content, "object-1", null, null);

请注意,这个类的名称是XMLObject,而不是Object,以避免与现有java命名冲突。对象类。

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

List<XMLStructure> objectContentList = object.getContent();
for (XMLStructure objectContent : objectContentList) {
  LOG.log(POILogger.DEBUG, "object content java type: " + objectContent.getClass().getName());

代码示例来源:origin: org.apache.santuario/xmlsec

public static void marshal(XmlWriter xwriter, XMLObject xmlObj, String dsPrefix, XMLCryptoContext context)
  throws MarshalException {
  xwriter.writeStartElement(dsPrefix, "Object", XMLSignature.XMLNS);
  // set attributes
  xwriter.writeIdAttribute("", "", "Id", xmlObj.getId());
  xwriter.writeAttribute("", "", "MimeType", xmlObj.getMimeType());
  xwriter.writeAttribute("", "", "Encoding", xmlObj.getEncoding());
  // create and append any elements and mixed content, if necessary
  @SuppressWarnings("unchecked")
  List<XMLStructure> content = xmlObj.getContent();
  for (XMLStructure object : content) {
    xwriter.marshalStructure(object, dsPrefix, context);
  }
  xwriter.writeEndElement(); // "Object"
}

代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer

XMLObject idPackageObject = null;
for (XMLObject object : objects) {
  if ("idPackageObject".equals(object.getId())) {
    idPackageObject = object;
    break;
  continue;
List<XMLStructure> idPackageObjectContent = idPackageObject.getContent();
Manifest idPackageObjectManifest = null;
for (XMLStructure content : idPackageObjectContent) {

代码示例来源:origin: org.apache.santuario/xmlsec

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof XMLObject)) {
    return false;
  }
  XMLObject oxo = (XMLObject)o;
  boolean idsEqual = id == null ? oxo.getId() == null
                  : id.equals(oxo.getId());
  boolean encodingsEqual =
    encoding == null ? oxo.getEncoding() == null
             : encoding.equals(oxo.getEncoding());
  boolean mimeTypesEqual =
    mimeType == null ? oxo.getMimeType() == null
             : mimeType.equals(oxo.getMimeType());
  return idsEqual && encodingsEqual && mimeTypesEqual &&
      equalsContent(getXmlObjectContent(oxo));
}

代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer

@SuppressWarnings("unchecked")
private XMLObject findObject(XMLSignature xmlSignature, String objectId) {
  List<XMLObject> objects = xmlSignature.getObjects();
  for (XMLObject object : objects) {
    if (objectId.equals(object.getId())) {
      LOG.debug("Found \"" + objectId + "\" ds:object");
      return object;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.santuario/xmlsec

signatureIdMap.put(obj.getId(), obj);
List<XMLStructure> content = DOMXMLObject.getXmlObjectContent(obj);
for (XMLStructure xs : content) {

代码示例来源:origin: org.apache.santuario/xmlsec

@SuppressWarnings("unchecked")
public static List<XMLStructure> getXmlObjectContent(XMLObject xo) {
  return xo.getContent();
}

代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer

if (1 != idOfficeObject.getContent().size()) {
  LOG.error("Expect SignatureProperties element in \"idPackageObject\".");
  return false;
signatureProperties = (SignatureProperties) idOfficeObject.getContent().get(0);

代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer

if (2 != idPackageObject.getContent().size()) {
  LOG.error("Expect Manifest + SignatureProperties elements in \"idPackageObject\".");
  return false;
manifest = (Manifest) idPackageObject.getContent().get(0);
signatureProperties = (SignatureProperties) idPackageObject.getContent().get(1);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

if (object instanceof XMLObject) {
  XMLObject xmlObject = (XMLObject)object;
  for (Object xmlStructure : xmlObject.getContent()) {
    if (xmlStructure instanceof Manifest) {
      throw new WSSecurityException(

代码示例来源:origin: org.apache.ws.security/wss4j

if (object instanceof XMLObject) {
  XMLObject xmlObject = (XMLObject)object;
  for (Object xmlStructure : xmlObject.getContent()) {
    if (xmlStructure instanceof Manifest) {
      throw new WSSecurityException(

代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer

List<XMLStructure> objectContentList = object.getContent();
for (XMLStructure objectContent : objectContentList) {
  LOG.debug("object content java type: " + objectContent.getClass().getName());

代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom

if (object instanceof XMLObject) {
  XMLObject xmlObject = (XMLObject)object;
  for (Object xmlStructure : xmlObject.getContent()) {
    if (xmlStructure instanceof Manifest) {
      bspEnforcer.handleBSPRule(BSPRule.R5403);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

List<XMLStructure> objectContentList = object.getContent();
for (XMLStructure objectContent : objectContentList) {
  LOG.log(POILogger.DEBUG, "object content java type: " + objectContent.getClass().getName());

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com