@Override protected boolean process() { if ("ASiC-S".equals(containerInfo.getContainerType())) { // ASiC-S no Manifest message = MessageTag.BBB_FC_IMFP_ASICS; error = MessageTag.BBB_FC_IMFP_ASICS_ANS; return Utils.isCollectionEmpty(containerInfo.getManifestFiles()); } else { // ASiC-E one or more manifest message = MessageTag.BBB_FC_IMFP_ASICE; error = MessageTag.BBB_FC_IMFP_ASICE_ANS; return Utils.isCollectionNotEmpty(containerInfo.getManifestFiles()); } }
/** * Create an instance of {@link XmlContainerInfo } * */ public XmlContainerInfo createXmlContainerInfo() { return new XmlContainerInfo(); }
/** * This method returns the content of the mimetype file (if container) * * @return the content of the mimetype file */ public String getMimetypeFileContent() { XmlContainerInfo containerInfo = wrapped.getContainerInfo(); if (containerInfo != null) { return containerInfo.getMimeTypeContent(); } return null; }
@Override protected boolean process() { /* ASiC-S -> nb files = 1 */ if ("ASiC-S".equals(containerInfo.getContainerType())) { return 1 == Utils.collectionSize(containerInfo.getContentFiles()); } else if ("ASiC-E".equals(containerInfo.getContainerType())) { String signatureFilename = signature.getSignatureFilename(); List<String> coveredFiles = getCoveredFilesBySignatureFilename(signatureFilename); List<String> contentFiles = containerInfo.getContentFiles(); // check manifest <> content if (!sameContent(coveredFiles, contentFiles)) { return false; } // XAdES -> check signature scope if (signature.getFormat().startsWith("XAdES")) { List<String> coveredFilesFromScope = getCoveredFilesFromScope(); return sameContent(coveredFilesFromScope, contentFiles); } // CAdES -> manifest file is signed return true; } return false; }
/** * This method returns the container type * * @return the container type (ASiC-S/E) */ public String getContainerType() { XmlContainerInfo containerInfo = wrapped.getContainerInfo(); if (containerInfo != null) { return containerInfo.getContainerType(); } return null; }
/** * This method checks if the container has a mimetype file * * @return true if the mimetype file is present */ public boolean isMimetypeFilePresent() { XmlContainerInfo containerInfo = wrapped.getContainerInfo(); if (containerInfo != null) { return containerInfo.isMimeTypeFilePresent(); } return false; }
/** * This method returns the zip comment (if the document is a container) * * @return the zip comment for the current document (if container) or null */ public String getZipComment() { XmlContainerInfo containerInfo = wrapped.getContainerInfo(); if (containerInfo != null) { return containerInfo.getZipComment(); } return null; }
private List<String> getCoveredFilesBySignatureFilename(String signatureFilename) { List<XmlManifestFile> manifestFiles = containerInfo.getManifestFiles(); for (XmlManifestFile xmlManifestFile : manifestFiles) { if (Utils.areStringsEqual(signatureFilename, xmlManifestFile.getSignatureFilename())) { return xmlManifestFile.getEntries(); } } return new ArrayList<String>(); }
private String getContainerType() { if (dssReports.getDiagnosticData().getContainerInfo() != null) return dssReports.getDiagnosticData().getContainerInfo().getContainerType(); return null; }