diff options
author | andre.schmid <andre.schmid@est.tech> | 2019-09-30 17:47:27 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2019-11-03 16:44:13 +0000 |
commit | f34e28d521b71be501dc85e75c5efa411c3194f1 (patch) | |
tree | 461dba7844dda13f0aad36c660c64cade0833cdf /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib | |
parent | 608be265c8491686f269ed12d5d48654ddb090b5 (diff) |
Validate artifacts signature in SOL004 package
Change-Id: Ib048f4501fd8a81cdf11fab19f149350011f772e
Issue-ID: SDC-2632
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
1 files changed, 13 insertions, 13 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java index ca60577b29..d6b1194b81 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java @@ -23,11 +23,11 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi; import static org.openecomp.sdc.tosca.csar.CSARConstants.ARTIFACTS_FOLDER; import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_CHANGE_LOG; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_MANIFEST; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ENTRY_DEFINITIONS; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_CHANGE_LOG; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_MANIFEST; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.TOSCA_META_PATH_FILE_NAME; import java.io.IOException; import java.io.InputStream; @@ -203,18 +203,18 @@ public class ETSIServiceImpl implements ETSIService { private boolean hasMetaMandatoryEntries(final ToscaMetadata toscaMetadata) { final Map<String, String> metaDataEntries = toscaMetadata.getMetaEntries(); - return metaDataEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS) && metaDataEntries - .containsKey(TOSCA_META_ETSI_ENTRY_MANIFEST) - && metaDataEntries.containsKey(TOSCA_META_ETSI_ENTRY_CHANGE_LOG); + return metaDataEntries.containsKey(ENTRY_DEFINITIONS.getName()) && metaDataEntries + .containsKey(ETSI_ENTRY_MANIFEST.getName()) + && metaDataEntries.containsKey(ETSI_ENTRY_CHANGE_LOG.getName()); } private boolean isMetaFilePresent(Map<String, byte[]> handler) { - return handler.containsKey(TOSCA_META_PATH_FILE_NAME) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME); + return handler.containsKey(TOSCA_META_PATH_FILE_NAME.getName()) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME); } public ResourceTypeEnum getResourceType(FileContentHandler handler) throws IOException { ToscaMetadata metadata = getMetadata(handler); - Manifest manifest = getManifest(handler, metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST)); + Manifest manifest = getManifest(handler, metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName())); return getResourceType(manifest); } @@ -231,7 +231,7 @@ public class ETSIServiceImpl implements ETSIService { public Manifest getManifest(FileContentHandler handler) throws IOException { ToscaMetadata metadata = getMetadata(handler); - return getManifest(handler, metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST)); + return getManifest(handler, metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName())); } private Manifest getManifest(FileContentHandler handler, String manifestLocation) throws IOException { @@ -244,16 +244,16 @@ public class ETSIServiceImpl implements ETSIService { public Path getOriginalManifestPath(final FileContentHandler handler) throws IOException { final ToscaMetadata metadata = getOriginalMetadata(handler); - final String originalMetadataPath = metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST); + final String originalMetadataPath = metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName()); final Path path = Paths.get(originalMetadataPath); return path.getParent() == null ? Paths.get("") : path.getParent(); } private ToscaMetadata getMetadata(FileContentHandler handler) throws IOException { ToscaMetadata metadata; - if (handler.containsFile(TOSCA_META_PATH_FILE_NAME)) { + if (handler.containsFile(TOSCA_META_PATH_FILE_NAME.getName())) { metadata = OnboardingToscaMetadata - .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME)); + .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME.getName())); } else if (handler.containsFile(TOSCA_META_ORIG_PATH_FILE_NAME)) { metadata = OnboardingToscaMetadata .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_ORIG_PATH_FILE_NAME)); |