private void addSignatures(final ProcessParameters params, final XmlNode simpleReport) throws DSSException { final List<XmlDom> signatures = diagnosticData.getElements("/DiagnosticData/Signature"); validSignatureCount = 0; totalSignatureCount = 0; for (final XmlDom signatureXmlDom : signatures) { addSignature(params, simpleReport, signatureXmlDom); } }
/** * Indicates if there is an archive timestamp. * * @param signatureId The identifier of the signature. * @return true if the archive timestamp is present */ public boolean isThereALevel(final String signatureId) { final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.ARCHIVE_TIMESTAMP.name()); return timestamps.size() > 0; }
public List<String> getCertificateTSPServiceQualifiers(final int dssCertificateId) { List<String> tspServiceQualifiers = new ArrayList<String>(); final List<XmlDom> TSPServiceQualifiers = getElements("/DiagnosticData/UsedCertificates/Certificate[@Id='%s']/TrustedServiceProvider/Qualifiers/Qualifier", dssCertificateId); for (XmlDom tspServiceQualifier : TSPServiceQualifiers) { tspServiceQualifiers.add(tspServiceQualifier.getText()); } return tspServiceQualifiers; }
/** * Indicates if there is a signature timestamp. * * @param signatureId The identifier of the signature. * @return true if the signature timestamp is present */ public boolean isThereTLevel(final String signatureId) { final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.SIGNATURE_TIMESTAMP.name()); return timestamps.size() > 0; }
public List<String> getTrueQCStatements() { List<String> trueQcStatements = new ArrayList<String>(); final List<XmlDom> qcStatements = getElements("/DiagnosticData/UsedCertificates/Certificate/QCStatement"); for (XmlDom qcStatement : qcStatements) { NodeList qcNodes = qcStatement.getRootElement().getChildNodes(); for (int i = 0; i < qcNodes.getLength(); ++i) { if (qcNodes.item(i).getTextContent().toLowerCase().equals("true")) { trueQcStatements.add(qcNodes.item(i).getNodeName()); } } } return trueQcStatements; }
/** * Indicates if there is an -X1 or -X2 timestamp. * * @param signatureId The identifier of the signature. * @return true if the -X1 or -X2 is present */ public boolean isThereXLevel(final String signatureId) { final List<XmlDom> vdroTimestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.VALIDATION_DATA_REFSONLY_TIMESTAMP.name()); final List<XmlDom> vdTimestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.VALIDATION_DATA_TIMESTAMP.name()); return vdroTimestamps.size() > 0 || vdTimestamps.size() > 0; }
/** * This method returns the list of certificates in the chain of the main signature. * * @param signatureId The identifier of the signature. * @return list of certificate's dss id for the given signature. */ public List<Integer> getSignatureCertificateChain(final String signatureId) { final ArrayList<Integer> certificateChain = new ArrayList<Integer>(); final List<XmlDom> certificateId = getElements("/DiagnosticData/Signature[@Id='%s']/CertificateChain/ChainCertificate", signatureId); for (final XmlDom xmlDom : certificateId) { final String id = xmlDom.getAttribute("Id"); certificateChain.add(Integer.valueOf(id)); } return certificateChain; }
/** * This method returns the list of identifier of the timestamps related to the given signature. * * @param signatureId The identifier of the signature. * @return The list of identifier of the timestamps */ public List<String> getTimestampIdList(final String signatureId) { final List<String> timestampIdList = new ArrayList<String>(); final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp", signatureId); for (final XmlDom timestamp : timestamps) { final String timestampId = timestamp.getAttribute("Id"); timestampIdList.add(timestampId); } return timestampIdList; }
/** * This method returns the list of the signature id. The result is stored in the local variable. * * @return list of signature ids, is never null, can be empty */ public List<String> getSignatureIdList() { if (signatureIdList == null) { signatureIdList = new ArrayList<String>(); final List<XmlDom> signatures = getElements("/DiagnosticData/Signature"); for (final XmlDom signature : signatures) { final String signatureId = signature.getAttribute("Id"); signatureIdList.add(signatureId); } } return signatureIdList; }
/** * This method returns the list of identifier of the timestamps related to the given signature. * * @param signatureId The identifier of the signature. * @param timestampType The {@code TimestampType} * @return The list of identifier of the timestamps */ public List<String> getTimestampIdList(final String signatureId, final TimestampType timestampType) { final List<String> timestampIdList = new ArrayList<String>(); final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, timestampType.name()); for (final XmlDom timestamp : timestamps) { final String timestampId = timestamp.getAttribute("Id"); timestampIdList.add(timestampId); } return timestampIdList; }
/** * Indicates if the -X level is technically valid. It means that the signature and the digest are valid. * * @param signatureId The identifier of the signature. * @return true if the signature and digest are valid */ public boolean isXLevelTechnicallyValid(final String signatureId) { final List<XmlDom> vdroTimestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.VALIDATION_DATA_REFSONLY_TIMESTAMP.name()); final List<XmlDom> vdTimestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.VALIDATION_DATA_TIMESTAMP.name()); final List<XmlDom> timestamps = new ArrayList<XmlDom>(vdroTimestamps); timestamps.addAll(vdroTimestamps); for (final XmlDom timestamp : timestamps) { final boolean signatureValid = timestamp.getBoolValue("./BasicSignature/SignatureValid/text()"); final boolean messageImprintIntact = timestamp.getBoolValue("./MessageImprintDataIntact/text()"); if (signatureValid && messageImprintIntact) { return true; } } return false; }
/** * Indicates if the -T level is technically valid. It means that the signature and the digest are valid. * * @param signatureId The identifier of the signature. * @return true if the signature and digest are valid */ public boolean isTLevelTechnicallyValid(final String signatureId) { final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.SIGNATURE_TIMESTAMP.name()); for (final XmlDom timestamp : timestamps) { final boolean signatureValid = timestamp.getBoolValue("./BasicSignature/SignatureValid/text()"); final boolean messageImprintIntact = timestamp.getBoolValue("./MessageImprintDataIntact/text()"); if (signatureValid && messageImprintIntact) { return true; } } return false; }
/** * Indicates if the -A (-LTA) level is technically valid. It means that the signature of the archive timestamps are valid and their imprint is valid too. * * @param signatureId The identifier of the signature. * @return true if the signature and digest are valid */ public boolean isALevelTechnicallyValid(final String signatureId) { final List<XmlDom> timestamps = getElements("/DiagnosticData/Signature[@Id='%s']/Timestamps/Timestamp[@Type='%s']", signatureId, TimestampType.ARCHIVE_TIMESTAMP.name()); for (final XmlDom timestamp : timestamps) { final boolean signatureValid = timestamp.getBoolValue("./BasicSignature/SignatureValid/text()"); final boolean messageImprintIntact = timestamp.getBoolValue("./MessageImprintDataIntact/text()"); if (signatureValid && messageImprintIntact) { return true; } } return false; }