private void addCounterSignature(XmlDom diagnosticSignature, XmlNode signatureNode, String type) { if (AttributeValue.COUNTERSIGNATURE.equals(type)) { signatureNode.setAttribute(AttributeName.TYPE, AttributeValue.COUNTERSIGNATURE); final String parentId = diagnosticSignature.getValue("./ParentId/text()"); signatureNode.setAttribute(AttributeName.PARENT_ID, parentId); } }
/** * This method adds the Info {@code XmlNode} to the given {@code XmlNode} * * @param xmlNode The node to which the Info node is added */ public void addTo(final XmlNode xmlNode) { final XmlNode info = xmlNode.addChild(INFO, value); for (final Entry<String, String> entry : attributes.entrySet()) { info.setAttribute(entry.getKey(), entry.getValue()); } }
private void addSignatureFormat(final XmlDom diagnosticSignature, final XmlNode signatureNode) { signatureNode.setAttribute(NodeName.SIGNATURE_FORMAT, diagnosticSignature.getValue("./SignatureFormat/text()")); }
private void basicInfoToXmlNode(List<?> basicInfoList, final String infoLevel, final XmlNode conclusion) { if (basicInfoList != null) { for (final Object basicInfoObject : basicInfoList) { BasicInfo basicInfo = (BasicInfo) basicInfoObject; final XmlNode infoNode = conclusion.addChild(infoLevel, basicInfo.getValue()); for (final Entry<String, String> entry : basicInfo.attributes.entrySet()) { infoNode.setAttribute(entry.getKey(), entry.getValue()); } } } }
/** * @param constraintNode */ private void addControlTime(XmlNode constraintNode) { String formatedControlTime = DSSUtils.formatDate(controlTime); constraintNode.addChild(INFO).setAttribute(CONTROL_TIME, formatedControlTime); }
/** * @param xmlNode the {@code XmlNode} to which the element is added * @param element the {@code Node} to be copied */ private static void recursiveCopy(final XmlNode xmlNode, final Node element) { final String name = element.getNodeName(); final XmlNode _xmlNode = new XmlNode(name); final NamedNodeMap attributes = element.getAttributes(); for (int jj = 0; jj < attributes.getLength(); jj++) { final Node attrNode = attributes.item(jj); final String attrName = attrNode.getNodeName(); if (!"xmlns".equals(attrName)) { _xmlNode.setAttribute(attrName, attrNode.getNodeValue()); } } final NodeList nodes = element.getChildNodes(); boolean hasElementNodes = false; for (int ii = 0; ii < nodes.getLength(); ii++) { final Node node = nodes.item(ii); if (node.getNodeType() == Node.ELEMENT_NODE) { hasElementNodes = true; recursiveCopy(_xmlNode, node); } } if (!hasElementNodes) { final String value = element.getTextContent(); _xmlNode.setValue(value); } _xmlNode.setParent(xmlNode); }
/** * This method creates the constraint {@code XmlNode}. This method should be used when the message describing the constraint comports dynamic parameters. * * @param parentNode Represents the parent {@code XmlNode} to which the constraint node should be attached. * @param messageTag is the message describing the constraint. * @param parameters the dynamic parameters to integrate into the message. * @return the {@code XmlNode} representing the current constraint in the validation process. */ public XmlNode create(final XmlNode parentNode, final MessageTag messageTag, final String parameters) { this.node = parentNode.addChild(CONSTRAINT); final String message = String.format(messageTag.getMessage(), parameters); this.node.addChild(NAME, message).setAttribute(NAME_ID, messageTag.name()); return this.node; }
/** * @param messageTag * @return */ private XmlNode addConstraint(final MessageTag messageTag) { XmlNode constraintNode = validationDataXmlNode.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; } }
/** * @param messageTag * @return */ private XmlNode addConstraint(final MessageTag messageTag) { XmlNode constraintNode = pastSignatureValidationData.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; } }
/** * @param messageTag * @return */ private XmlNode addConstraint(final MessageTag messageTag) { XmlNode constraintNode = controlTimeSlidingData.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; }
/** * @param parent * @param messageTag * @return */ private XmlNode addConstraint(final XmlNode parent, final MessageTag messageTag) { XmlNode constraintNode = parent.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; }
/** * This method creates the constraint {@code XmlNode}. * * @param parentNode Represents the parent {@code XmlNode} to which the constraint node should be attached. * @param messageTag is the message describing the constraint. * @return the {@code XmlNode} representing the current constraint in the validation process */ public XmlNode create(final XmlNode parentNode, final MessageTag messageTag) { this.node = parentNode.addChild(CONSTRAINT); this.node.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return this.node; }
/** * @param messageTag * @return */ private XmlNode addConstraint(final MessageTag messageTag) { final XmlNode constraintNode = subProcessNode.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; }
/** * This method adds the constraint * * @param parentNode * @param messageTag * @return */ private XmlNode addConstraint(final XmlNode parentNode, final MessageTag messageTag) { final XmlNode constraintNode = parentNode.addChild(CONSTRAINT); constraintNode.addChild(NAME, messageTag.getMessage()).setAttribute(NAME_ID, messageTag.name()); return constraintNode; } }
node.addChild(INFO, null, messageAttributes).setAttribute(EXPECTED_VALUE, expectedValue).setAttribute(CONSTRAINT_VALUE, value); return true; final XmlNode xmlNode = node.addChild(WARNING, failureMessageTag, messageAttributes); if (DSSUtils.isNotBlank(expectedValue) && !expectedValue.equals("true") && !expectedValue.equals("false")) { xmlNode.setAttribute(EXPECTED_VALUE, expectedValue).setAttribute(CONSTRAINT_VALUE, value); node.addChild(INFO).setAttribute(EXPECTED_VALUE, expectedValue).setAttribute(CONSTRAINT_VALUE, value);
private void checkDigestAlgoExpirationDate(final XmlDom token, final XmlNode infoContainerNode, final String message) { String digestAlgo = token.getValue(XP_DIGEST_ALGO_USED_TO_SIGN_THIS_TOKEN); digestAlgo = RuleUtils.canonicalizeSignatureAlgo(digestAlgo); final Date algoExpirationDate = constraintData.getAlgorithmExpirationDate(digestAlgo); if (algoExpirationDate != null && controlTime.after(algoExpirationDate)) { controlTime = algoExpirationDate; final String formatedCertAlgoExpirationDate = DSSUtils.formatDate(algoExpirationDate); infoContainerNode.addChild(INFO, message); infoContainerNode.addChild(INFO).setAttribute(ALGORITHM_EXPIRATION_DATE, formatedCertAlgoExpirationDate); } } }
node.addChild(INFO, null, messageAttributes).setAttribute("ExpectedValue", expectedValue).setAttribute("ConstraintValue", value); return true; node.addChild(WARNING, failureMessageTag, messageAttributes).setAttribute(EXPECTED_VALUE, expectedValue).setAttribute(CONSTRAINT_VALUE, value); conclusion.addWarning(failureMessageTag, messageAttributes); return true; node.addChild(INFO).setAttribute(EXPECTED_VALUE, expectedValue).setAttribute(CONSTRAINT_VALUE, value); conclusion.setIndication(indication, subIndication); conclusion.addError(failureMessageTag, messageAttributes);
private void checkEncryptionAlgoExpirationDate(final XmlDom token, final XmlNode infoContainerNode, final String message) { String encryptionAlgo = token.getValue(XP_ENCRYPTION_ALGO_USED_TO_SIGN_THIS_TOKEN); encryptionAlgo = RuleUtils.canonicalizeEncryptionAlgo(encryptionAlgo); final String encryptionKeyLength = token.getValue(XP_KEY_LENGTH_USED_TO_SIGN_THIS_TOKEN); final String algoWithKeyLength = encryptionAlgo + encryptionKeyLength; final Date algoExpirationDate = constraintData.getAlgorithmExpirationDate(algoWithKeyLength); if (algoExpirationDate != null && controlTime.after(algoExpirationDate)) { controlTime = algoExpirationDate; final String formatedCertAlgoExpirationDate = DSSUtils.formatDate(algoExpirationDate); infoContainerNode.addChild(INFO, message); infoContainerNode.addChild(INFO).setAttribute(ALGORITHM_EXPIRATION_DATE, formatedCertAlgoExpirationDate); } }
node.addChild(INFO, null, messageAttributes).setAttribute("ExpectedValue", expectedValue).setAttribute("ConstraintValue", value); return true; node.addChild(INFO).setAttribute(EXPIRED_CERTS_REVOCATION_INFO, formatedExpiredCertsRevocationInfo);
signatureNode.setAttribute(ID, signatureId);