本文整理汇总了Java中javax.xml.crypto.dom.DOMStructure.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java DOMStructure.getNode方法的具体用法?Java DOMStructure.getNode怎么用?Java DOMStructure.getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.crypto.dom.DOMStructure
的用法示例。
在下文中一共展示了DOMStructure.getNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshalParams
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
@Override
public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException {
LOG.debug("marshallParams(parent,context)");
DOMStructure domParent = (DOMStructure) parent;
Node parentNode = domParent.getNode();
Element parentElement = (Element) parentNode;
parentElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:mdssi",
"http://schemas.openxmlformats.org/package/2006/digital-signature");
Document document = parentNode.getOwnerDocument();
for (String sourceId : this.sourceIds) {
Element relationshipReferenceElement = document.createElementNS(
"http://schemas.openxmlformats.org/package/2006/digital-signature", "mdssi:RelationshipReference");
relationshipReferenceElement.setAttribute("SourceId", sourceId);
parentElement.appendChild(relationshipReferenceElement);
}
for (String sourceType : this.sourceTypes) {
Element relationshipsGroupReferenceElement = document.createElementNS(
"http://schemas.openxmlformats.org/package/2006/digital-signature",
"mdssi:RelationshipsGroupReference");
relationshipsGroupReferenceElement.setAttribute("SourceType", sourceType);
parentElement.appendChild(relationshipsGroupReferenceElement);
}
}
示例2: getNodeForMessageBodyInEnvelopingCase
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
protected Node getNodeForMessageBodyInEnvelopingCase(Input input) throws Exception { //NOPMD
Node node;
List<Reference> relevantReferences = getReferencesForMessageMapping(input);
List<XMLObject> relevantObjects = getObjectsForMessageMapping(input);
DOMStructure domStruc = getDomStructureForMessageBody(relevantReferences, relevantObjects);
node = domStruc.getNode();
return node;
}
示例3: getSigningCertificate
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna o XML que contem SigningCertificate, que eh uma das propriedades assinadas obrigatorias da ICP-BRASIL.
* contem cert = conforme DOC-ICP-04; CertDigest: /DigestMethod e /DigestValue; IssuerSerial: /X509IssuerName e /X509SerialNumber
* @param ix indica de qual a assinatura.
* @return org.w3c.NodeList contendo SigningCertificate ou nulo
* @throws Exception
*/
public NodeList getSigningCertificate(int ix) throws Exception{
NodeList nodeSigningCertificate = null;
if (this.getAssinaturas().isEmpty()){
return null;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
nodeSigningCertificate = el.getElementsByTagName("SigningCertificate");
break;
}
}
// se a lista estiver vazia retornar� nulo
if (nodeSigningCertificate.getLength() < 1){
nodeSigningCertificate = null;
}
}
}
}
return nodeSigningCertificate;
}
示例4: getSignaturePolicyIdentifier
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SignaturePolicyIdentifier, que identifica qual eh a politica de assinatura.
* Eh uma das propriedades assinadas obrigatorias da ICP-BRASIL. Atualmente contem dos atributos:
* SigPolicyId e SPURI
*
* @param ix indica de qual a assinatura.
* @return NodeList da politica de assinatura ou nulo.
* @throws DOMException
*/
public NodeList getSignaturePolicyIdentifier(int ix) throws DOMException {
NodeList signaturePolicyIdentifier = null;
if (this.getAssinaturas().isEmpty()){
return signaturePolicyIdentifier;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
signaturePolicyIdentifier = el.getElementsByTagName("SignaturePolicyIdentifier");
// se a lista estiver vazia retornar� nulo
break;
}
}
if (signaturePolicyIdentifier.getLength() < 1){
signaturePolicyIdentifier = null;
}
}
}
}
return signaturePolicyIdentifier;
}
示例5: getSigPolicyId
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SigPolicyId, que e uma das propriedades de SignaturePolicyIdentifier
* @param ix indica de qual a assinatura.
* @return String de SigPolicyId
* @throws DOMException
*/
public String getSigPolicyId(int ix) throws DOMException {
String sigPolicyId = null;
if (this.getAssinaturas().isEmpty()){
return sigPolicyId;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeSigId = el.getElementsByTagName("SigPolicyId");
if (nodeSigId.getLength() > 0){
sigPolicyId = nodeSigId.item(0).getTextContent();
}
break;
}
}
}
}
}
return sigPolicyId;
}
示例6: getSPURI
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SPURI, que eh uma das propriedades de SignaturePolicyIdentifier
* @param ix indica de qual a assinatura.
* @return String de SPURI
* @throws DOMException
*/
public String getSPURI(int ix) throws DOMException {
String SPURI = null;
if (this.getAssinaturas().isEmpty()){
return SPURI;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeSPURI = el.getElementsByTagName("SPURI");
if (nodeSPURI.getLength() > 0){
SPURI = nodeSPURI.item(0).getTextContent();
}
break;
}
}
}
}
}
return SPURI;
}
示例7: getDataObjectFormat
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna DataObjectFormat do objeto Assinado
* Eh uma das propriedades assinadas obrigatorias da ICP-BRASIL. Nao faz muito sentido para ENVELOPEDXML.
* @param ix indica de qual a assinatura.
* @return String com formato (MimeTye) do conteudo assinado.
* @throws Exception
*/
public String getDataObjectFormat(int ix) throws DOMException {
String dataObjectFormat = null;
if (this.getAssinaturas().isEmpty()){
return dataObjectFormat;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeMimeType = el.getElementsByTagName("MimeType");
if (nodeMimeType.getLength() > 0 ){
dataObjectFormat = nodeMimeType.item(0).getTextContent();
}
break;
}
}
}
}
}
return dataObjectFormat;
}
示例8: getContraAssinatura
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna um NodeList da propriedade CounterSignature, se houver.
* esta lista contem o elemento Signature que foi contra assinado, este por sua vez
* tambem pode possuir um elemento CounterSignature recursivamente igual.
*
* @param ix -> indice da assinatura
* @return NodeList -> CounterSignature ou nulo
* @throws Exception
*/
public NodeList getContraAssinatura(int ix) throws Exception{
NodeList nodeContraAssiantura = null;
if (this.getAssinaturas().isEmpty()){
return nodeContraAssiantura;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
nodeContraAssiantura = el.getElementsByTagName("CounterSignature");
break;
}
}
// se a lista estiver vazia retornar� nulo
if (nodeContraAssiantura.getLength() < 1){
nodeContraAssiantura = null;
}
}
}
}
return nodeContraAssiantura;
}
示例9: getDataAssinatura
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna a data de Assinatura contida em SigningTime
* Nao eh carimbo de tempo.
* @param ix indica de qual a assinatura.
* @return Date com data da assinatura
* @throws ParseException
* @throws DOMException
*/
public Date getDataAssinatura(int ix) throws DOMException, ParseException {
Date dataAssinatura = null;
if (this.getAssinaturas().isEmpty()){
return dataAssinatura;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeQualifying = el.getElementsByTagName("SigningTime");
if (nodeQualifying.getLength() > 0){
Locale locale = new Locale("pt","BR");
SimpleDateFormat formatador = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ",locale);
dataAssinatura = (Date)formatador.parse(nodeQualifying.item(0).getTextContent());
}
break;
}
}
}
}
}
return dataAssinatura;
}
示例10: getSigningCertificate
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna o XML que contem SigningCertificate, que eh uma das propriedades assinadas obrigatorias da ICP-BRASIL.
* contem cert = conforme DOC-ICP-04; CertDigest: /DigestMethod e /DigestValue; IssuerSerial: /X509IssuerName e /X509SerialNumber
* @param ix indica de qual a assinatura.
* @return org.w3c.NodeList contendo SigningCertificate ou nulo
* @throws Exception
*/
public NodeList getSigningCertificate(int ix) throws Exception{
NodeList nodeSigningCertificate = null;
if (this.getAssinaturas().isEmpty()){
return null;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
nodeSigningCertificate = el.getElementsByTagName("SigningCertificate");
break;
}
}
// se a lista estiver vazia retornar� nulo
if (nodeSigningCertificate.getLength() < 1){
nodeSigningCertificate = null;
}
}
}
}
return nodeSigningCertificate;
}
示例11: getSignaturePolicyIdentifier
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SignaturePolicyIdentifier, que identifica qual eh a politica de assinatura.
* Eh uma das propriedades assinadas obrigatorias da ICP-BRASIL. Atualmente contem dos atributos:
* SigPolicyId e SPURI
*
* @param ix indica de qual a assinatura.
* @return NodeList da politica de assinatura ou nulo.
* @throws DOMException
*/
public NodeList getSignaturePolicyIdentifier(int ix) throws DOMException {
NodeList signaturePolicyIdentifier = null;
if (this.getAssinaturas().isEmpty()){
return signaturePolicyIdentifier;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
signaturePolicyIdentifier = el.getElementsByTagName("SignaturePolicyIdentifier");
break;
}
}
// se a lista estiver vazia retornar� nulo
if (signaturePolicyIdentifier.getLength() < 1){
signaturePolicyIdentifier = null;
}
}
}
}
return signaturePolicyIdentifier;
}
示例12: getSigPolicyId
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SigPolicyId, que e uma das propriedades de SignaturePolicyIdentifier
* @param ix indica de qual a assinatura.
* @return String de SigPolicyId
* @throws DOMException
*/
public String getSigPolicyId(int ix) throws DOMException {
String sigPolicyId = null;
if (this.getAssinaturas().isEmpty()){
return sigPolicyId;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeSigId = el.getElementsByTagName("SigPolicyId");
if (nodeSigId.getLength() > 0){
sigPolicyId = nodeSigId.item(0).getTextContent();
}
break;
}
}
}
}
}
return sigPolicyId;
}
示例13: getSPURI
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
/**
* Retorna SPURI, que eh uma das propriedades de SignaturePolicyIdentifier
* @param ix indica de qual a assinatura.
* @return String de SPURI
* @throws DOMException
*/
public String getSPURI(int ix) throws DOMException {
String SPURI = null;
if (this.getAssinaturas().isEmpty()){
return SPURI;
}
if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
DOMXMLObject objDX = null;
Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
while (it.hasNext()) {
Object ob1 = it.next();
if (ob1 instanceof DOMXMLObject){
objDX = (DOMXMLObject) ob1;
for (int i=0; i < objDX.getContent().size();i++){
DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);
if (Dos.getNode().getLocalName() == "QualifyingProperties"){
Element el = (Element) Dos.getNode();
NodeList nodeSPURI = el.getElementsByTagName("SPURI");
if (nodeSPURI.getLength() > 0){
SPURI = nodeSPURI.item(0).getTextContent();
}
break;
}
}
}
}
}
return SPURI;
}
示例14: validateSignatureProperty
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean validateSignatureProperty(SignatureProperty signatureProperty, String signatureId) {
if (!signatureProperty.getId().equals("idSignatureTime")) {
LOG.error("Unexpected SignatureProperty: expected id=idSignatureTime " + "but got: "
+ signatureProperty.getId());
return false;
}
if (!signatureProperty.getTarget().equals("#" + signatureId)) {
LOG.error("Unexpected SignatureProperty: expected target=#" + signatureId + "but got: "
+ signatureProperty.getTarget());
return false;
}
List<XMLStructure> signatureTimeContent = signatureProperty.getContent();
if (signatureTimeContent.size() != 1) {
LOG.error("Unexpected SignatureTime content.");
return false;
}
DOMStructure signatureTimeDOM = (DOMStructure) signatureTimeContent.get(0);
Node signatureTimeElement = signatureTimeDOM.getNode();
if (!signatureTimeElement.getNamespaceURI().equals(OOXMLSignatureFacet.OOXML_DIGSIG_NS)) {
LOG.error("Invalid SignatureTime element: NS=" + signatureTimeElement.getNamespaceURI());
return false;
}
if (!signatureTimeElement.getLocalName().equals("SignatureTime")) {
LOG.error("Invalid SignatureTime element: Name=" + signatureTimeElement.getLocalName());
return false;
}
if (signatureTimeElement.getChildNodes().getLength() != 2) {
LOG.error("Invalid SignatureTime element: Childs=" + signatureTimeElement.getChildNodes().getLength()
+ ", expected 2 (Format+Value)");
return false;
}
// format element
Node formatElement = signatureTimeElement.getChildNodes().item(0);
if (!formatElement.getNamespaceURI().equals(OOXMLSignatureFacet.OOXML_DIGSIG_NS)) {
LOG.error("Invalid SignatureTime.Format element: NS=" + formatElement.getNamespaceURI());
return false;
}
if (!formatElement.getLocalName().equals("Format")) {
LOG.error("Invalid SignatureTime.Format element: Name=" + formatElement.getLocalName());
return false;
}
// value element
Node valueElement = signatureTimeElement.getChildNodes().item(1);
if (!valueElement.getNamespaceURI().equals(OOXMLSignatureFacet.OOXML_DIGSIG_NS)) {
LOG.error("Invalid SignatureTime.Value element: NS=" + valueElement.getNamespaceURI());
return false;
}
if (!valueElement.getLocalName().equals("Value")) {
LOG.error("Invalid SignatureTime.Value element: Name=" + valueElement.getLocalName());
return false;
}
// TODO: validate value?
return true;
}
示例15: init
import javax.xml.crypto.dom.DOMStructure; //导入方法依赖的package包/类
public void init(XMLStructure parent, XMLCryptoContext context) throws InvalidAlgorithmParameterException {
super.init(parent, context);
log.debug("INIT2: " + transformElem);
DOMStructure str = (DOMStructure) parent;
str.getNode();
this.params = new ExcC14NParameterSpec();
}