2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.components.impl;
22 import fj.data.Either;
23 import java.io.ByteArrayInputStream;
24 import java.io.IOException;
25 import java.io.StringReader;
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.List;
30 import java.util.Optional;
31 import java.util.Properties;
32 import java.util.regex.Matcher;
33 import java.util.regex.Pattern;
34 import java.util.stream.Collectors;
35 import org.apache.commons.lang3.tuple.ImmutablePair;
36 import org.openecomp.sdc.be.config.BeEcompErrorManager;
37 import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
38 import org.openecomp.sdc.be.dao.api.ActionStatus;
39 import org.openecomp.sdc.be.impl.ComponentsUtils;
40 import org.openecomp.sdc.be.tosca.CsarUtils;
41 import org.openecomp.sdc.common.log.wrappers.Logger;
42 import org.openecomp.sdc.common.util.GeneralUtility;
43 import org.openecomp.sdc.exception.ResponseFormat;
45 public class CsarValidationUtils {
47 private static final Logger log = Logger.getLogger(CsarValidationUtils.class.getName());
48 private static final String TOSCA_META_FILE_VERSION = "TOSCA-Meta-File-Version";
49 private static final String CSAR_VERSION = "CSAR-Version";
50 private static final String CREATED_BY = "Created-By";
51 private static final String NEW_LINE_DELM = "\n";
52 private static final String TOSCA_METADATA = "TOSCA-Metadata";
53 private static final String TOSCA_FILE = "TOSCA.meta";
54 private static final String DEL_PATTERN = "([/\\\\]+)";
55 private static final String TOSCA_METADATA_PATH_PATTERN = TOSCA_METADATA +
56 // Artifact Group (i.e Deployment/Informational)
57 DEL_PATTERN + TOSCA_FILE;
58 private static final String TOSCA_META_ENTRY_DEFINITIONS = "Entry-Definitions";
59 private static final String[] TOSCA_METADATA_FIELDS = {TOSCA_META_FILE_VERSION, CSAR_VERSION, CREATED_BY, TOSCA_META_ENTRY_DEFINITIONS};
60 private static final String ARTIFACTS_METADATA_FILE = "HEAT.meta";
61 private static final String TOSCA_CSAR_EXTENSION = ".csar";
62 private static final String TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID = "TOSCA-Metadata/TOSCA.meta file is not in expected key-value form in csar, csar ID {}";
63 private static final String TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID = "TOSCA-Metadata/TOSCA.meta file not in expected key-value form in CSAR with id ";
64 private static final String CSAR_INTERNALS_ARE_INVALID = "CSAR internals are invalid";
65 private static final String ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID = "Entry-Definitions entry not found in TOSCA-Metadata/TOSCA.meta file, csar ID {}";
66 private static final String FILE_NOT_FOUND_IN_CSAR_WITH_ID = " file not found in CSAR with id ";
67 private static final String CSAR_STRUCTURE_IS_INVALID = "CSAR structure is invalid";
68 private static final String ENTRY_DEFINITIONS = "Entry-Definitions ";
69 private static final Pattern floatPattern = Pattern.compile("^\\d{1}[.]\\d{1}$");
72 * Utility classes, which are collections of static members, are not meant to be instantiated
74 private CsarValidationUtils() {
82 * @param componentsUtils
85 public static Either<Boolean, ResponseFormat> validateCsar(Map<String, byte[]> csar, String csarUUID, ComponentsUtils componentsUtils) {
86 Either<Boolean, ResponseFormat> validateStatus = validateIsTOSCAMetadataExist(csar, csarUUID, componentsUtils);
87 if (validateStatus.isRight()) {
88 return Either.right(validateStatus.right().value());
90 removeNonUniqueArtifactsFromCsar(csar);
91 log.trace("TOSCA-Metadata/TOSCA.meta file found, CSAR id {}", csarUUID);
92 validateStatus = validateTOSCAMetadataFile(csar, csarUUID, componentsUtils);
93 if (validateStatus.isRight()) {
94 return Either.right(validateStatus.right().value());
96 return Either.left(true);
99 private static void removeNonUniqueArtifactsFromCsar(Map<String, byte[]> csar) {
100 List<String> nonUniqueArtifactsToRemove = new ArrayList<>();
101 String[] paths = csar.keySet().toArray(new String[csar.keySet().size()]);
102 int numberOfArtifacts = paths.length;
103 for (int i = 0; i < numberOfArtifacts; ++i) {
104 collectNonUniqueArtifact(paths, i, numberOfArtifacts, nonUniqueArtifactsToRemove);
106 nonUniqueArtifactsToRemove.stream().forEach(csar::remove);
109 private static void collectNonUniqueArtifact(String[] paths, int currInd, int numberOfArtifacts, List<String> nonUniqueArtifactsToRemove) {
110 String[] parsedPath = paths[currInd].split("/");
111 String[] otherParsedPath;
112 int artifactNameInd = parsedPath.length - 1;
113 for (int j = currInd + 1; j < numberOfArtifacts; ++j) {
114 otherParsedPath = paths[j].split("/");
115 if (parsedPath.length == otherParsedPath.length && parsedPath.length > 3 && isEqualArtifactNames(parsedPath, otherParsedPath)) {
117 "Can't upload two artifact with the same name {}. The artifact with path {} will be handled, and the artifact with path {} will be ignored. ",
118 parsedPath[artifactNameInd], paths[currInd], paths[j]);
119 nonUniqueArtifactsToRemove.add(paths[j]);
124 private static boolean isEqualArtifactNames(String[] parsedPath, String[] otherParsedPath) {
125 boolean isEqualArtifactNames = false;
126 int artifactNameInd = parsedPath.length - 1;
127 int artifactGroupTypeInd = parsedPath.length - 3;
128 String groupType = parsedPath[artifactGroupTypeInd];
129 String artifactName = parsedPath[artifactNameInd];
130 String otherGroupType = otherParsedPath[artifactGroupTypeInd];
131 String otherArtifactName = otherParsedPath[artifactNameInd];
132 String vfcToscaName = parsedPath.length == 5 ? parsedPath[1] : null;
133 if (artifactName.equalsIgnoreCase(otherArtifactName) && groupType.equalsIgnoreCase(otherGroupType)) {
134 isEqualArtifactNames = vfcToscaName == null || vfcToscaName.equalsIgnoreCase(otherParsedPath[1]);
136 return isEqualArtifactNames;
139 public static Either<ImmutablePair<String, String>, ResponseFormat> getToscaYaml(Map<String, byte[]> csar, String csarUUID,
140 ComponentsUtils componentsUtils) {
141 Either<Boolean, ResponseFormat> validateStatus = validateIsTOSCAMetadataExist(csar, csarUUID, componentsUtils);
142 if (validateStatus.isRight()) {
143 return Either.right(validateStatus.right().value());
145 Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
146 Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
147 if (!keyOp.isPresent()) {
148 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
149 BeEcompErrorManager.getInstance()
150 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
151 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
152 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
154 byte[] toscaMetaBytes = csar.get(keyOp.get());
155 Properties props = new Properties();
157 String propStr = new String(toscaMetaBytes);
158 props.load(new StringReader(propStr.replace("\\", "\\\\")));
159 } catch (IOException e) {
160 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
161 BeEcompErrorManager.getInstance()
162 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
163 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
164 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
166 String yamlFileName = props.getProperty(TOSCA_META_ENTRY_DEFINITIONS);
167 String[] ops = yamlFileName.split(DEL_PATTERN);
168 List<String> list = Arrays.asList(ops);
169 String result = list.stream().map(x -> x).collect(Collectors.joining(DEL_PATTERN));
170 keyOp = csar.keySet().stream().filter(k -> Pattern.compile(result).matcher(k).matches()).findAny();
171 if (!keyOp.isPresent()) {
172 log.debug(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
173 BeEcompErrorManager.getInstance()
174 .logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
175 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
176 return Either.right(componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, yamlFileName));
178 log.trace("Found Entry-Definitions property in TOSCA-Metadata/TOSCA.meta, Entry-Definitions: {}, CSAR id: {}", yamlFileName, csarUUID);
179 byte[] yamlFileBytes = csar.get(yamlFileName);
180 if (yamlFileBytes == null) {
181 log.debug("Entry-Definitions {} file not found in csar, csar ID {}", yamlFileName, csarUUID);
182 BeEcompErrorManager.getInstance()
183 .logInternalDataError(ENTRY_DEFINITIONS + yamlFileName + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID, CSAR_STRUCTURE_IS_INVALID,
184 ErrorSeverity.ERROR);
185 return Either.right(componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, yamlFileName));
187 String yamlFileContents = new String(yamlFileBytes);
188 return Either.left(new ImmutablePair<>(yamlFileName, yamlFileContents));
191 public static Either<ImmutablePair<String, String>, ResponseFormat> getArtifactsMeta(Map<String, byte[]> csar, String csarUUID,
192 ComponentsUtils componentsUtils) {
193 if (!csar.containsKey(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE)) {
194 log.debug(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
195 BeEcompErrorManager.getInstance()
196 .logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
197 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
198 return Either.right(componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, ARTIFACTS_METADATA_FILE));
200 log.trace("Found Entry-Definitions property in TOSCA-Metadata/TOSCA.meta, Entry-Definitions: {}, CSAR id: {}", ARTIFACTS_METADATA_FILE,
202 byte[] artifactsMetaBytes = csar.get(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE);
203 if (artifactsMetaBytes == null) {
204 log.debug("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, ARTIFACTS_METADATA_FILE, csarUUID);
205 BeEcompErrorManager.getInstance().logInternalDataError(
206 ENTRY_DEFINITIONS + CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID,
207 CSAR_STRUCTURE_IS_INVALID, ErrorSeverity.ERROR);
209 componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE));
211 String artifactsFileContents = new String(artifactsMetaBytes);
212 return Either.left(new ImmutablePair<>(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE, artifactsFileContents));
215 public static Either<ImmutablePair<String, byte[]>, ResponseFormat> getArtifactContent(String csarUUID, Map<String, byte[]> csar,
216 String artifactPath, String artifactName,
217 ComponentsUtils componentsUtils) {
218 if (!csar.containsKey(artifactPath)) {
219 log.debug("Entry-Definitions entry not found in Artifacts/HEAT.meta file, csar ID {}", csarUUID);
220 BeEcompErrorManager.getInstance()
221 .logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
222 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
224 .right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND_IN_CSAR, CsarUtils.ARTIFACTS_PATH + artifactName, csarUUID));
226 log.trace("Found Entry-Definitions property in Artifacts/HEAT.meta, Entry-Definitions: {}, CSAR id: {}", artifactPath, csarUUID);
227 byte[] artifactFileBytes = csar.get(artifactPath);
228 if (artifactFileBytes == null) {
229 log.debug("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, artifactName, csarUUID);
230 BeEcompErrorManager.getInstance()
231 .logInternalDataError(ENTRY_DEFINITIONS + artifactPath + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID, CSAR_STRUCTURE_IS_INVALID,
232 ErrorSeverity.ERROR);
233 return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND_IN_CSAR, artifactPath, csarUUID));
235 return Either.left(new ImmutablePair<>(artifactName, artifactFileBytes));
238 private static Either<Boolean, ResponseFormat> validateTOSCAMetadataFile(Map<String, byte[]> csar, String csarUUID,
239 ComponentsUtils componentsUtils) {
240 Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
241 Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
242 if (!keyOp.isPresent()) {
243 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
244 BeEcompErrorManager.getInstance()
245 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
246 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
247 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
249 byte[] toscaMetaBytes = csar.get(keyOp.get());
250 String toscaMetadata = new String(toscaMetaBytes);
251 String[] splited = toscaMetadata.split(NEW_LINE_DELM);
252 if (splited == null || splited.length < TOSCA_METADATA_FIELDS.length) {
253 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
254 BeEcompErrorManager.getInstance()
255 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
256 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
257 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
259 Either<Boolean, ResponseFormat> blockStatus = validateBlock(csarUUID, splited, componentsUtils);
260 if (blockStatus.isRight()) {
261 return Either.right(blockStatus.right().value());
263 return Either.left(true);
266 private static Either<Boolean, ResponseFormat> validateBlock(String csarUUID, String[] splited, ComponentsUtils componentsUtils) {
268 for (String toscaField : TOSCA_METADATA_FIELDS) {
269 Properties props = new Properties();
271 props.load(new ByteArrayInputStream(splited[index].getBytes()));
272 } catch (IOException e) {
273 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
274 BeEcompErrorManager.getInstance()
275 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
276 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
277 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
279 if (!props.containsKey(toscaField)) {
280 log.debug("TOSCA.meta file format is invalid: No new line after block_0 as expected in csar, csar ID {}", csarUUID);
281 BeEcompErrorManager.getInstance()
282 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
283 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
284 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
286 String value = props.getProperty(toscaField);
287 if (value == null || value.isEmpty()) {
288 log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
289 BeEcompErrorManager.getInstance()
290 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
291 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
292 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
294 // TOSCA-Meta-File-Version & CSAR-Version : digit.digit - format
297 if ((toscaField.equals(TOSCA_META_FILE_VERSION) || toscaField.equals(CSAR_VERSION)) && !validateTOSCAMetaProperty(value)) {
298 log.debug("TOSCA-Metadata/TOSCA.meta file contains {} in wrong format (digit.digit), csar ID {}", toscaField, csarUUID);
299 BeEcompErrorManager.getInstance()
300 .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
301 CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
302 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
306 return Either.left(true);
309 private static boolean validateTOSCAMetaProperty(String toscaProperty) {
310 Matcher floatMatcher = floatPattern.matcher(toscaProperty);
311 return floatMatcher.matches();
314 private static Either<Boolean, ResponseFormat> validateIsTOSCAMetadataExist(Map<String, byte[]> csar, String csarUUID,
315 ComponentsUtils componentsUtils) {
316 if (csar == null || csar.isEmpty()) {
317 log.debug("Error when fetching csar with ID {}", csarUUID);
318 BeEcompErrorManager.getInstance().logBeDaoSystemError("Creating resource from CSAR: fetching CSAR with id " + csarUUID + " failed");
319 ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID, csarUUID);
320 return Either.right(responseFormat);
322 Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
323 Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
324 if (!keyOp.isPresent()) {
325 log.debug("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
326 BeEcompErrorManager.getInstance()
327 .logInternalDataError("TOSCA-Metadata/TOSCA.meta file not found in CSAR with id " + csarUUID, CSAR_STRUCTURE_IS_INVALID,
328 ErrorSeverity.ERROR);
329 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID, csarUUID));
331 byte[] toscaMetaBytes = csar.get(keyOp.get());
332 if (toscaMetaBytes == null || toscaMetaBytes.length == 0) {
333 log.debug("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
334 BeEcompErrorManager.getInstance()
335 .logInternalDataError("TOSCA-Metadata/TOSCA.meta file not found in CSAR with id " + csarUUID, CSAR_STRUCTURE_IS_INVALID,
336 ErrorSeverity.ERROR);
337 return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID, csarUUID));
339 return Either.left(Boolean.TRUE);
342 public static Either<String, ResponseFormat> getToscaYamlChecksum(Map<String, byte[]> csar, String csarUUID, ComponentsUtils componentsUtils) {
343 Either<ImmutablePair<String, String>, ResponseFormat> toscaYamlRes = getToscaYaml(csar, csarUUID, componentsUtils);
344 if (toscaYamlRes.isRight() || toscaYamlRes.left().value() == null || toscaYamlRes.left().value().getRight() == null) {
345 log.debug("Faild to create toscaYamlChecksum for csar, csar ID {}", csarUUID);
346 return Either.right(toscaYamlRes.right().value());
348 String newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(toscaYamlRes.left().value().getRight().getBytes());
349 return Either.left(newCheckSum);
352 public static boolean isCsarPayloadName(String payloadName) {
353 return payloadName != null && payloadName.toLowerCase().endsWith(TOSCA_CSAR_EXTENSION);