diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main')
3 files changed, 26 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java index 7cc11e564d..326eb6a517 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java @@ -372,6 +372,11 @@ abstract class AbstractOnboardingManifest implements Manifest { } @Override + public boolean isSigned() { + return getCmsSignature().isPresent(); + } + + @Override public Optional<String> getCmsSignature() { return Optional.ofNullable(cmsSignature); } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java index c0ccbbc14d..31b04f0d8b 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java @@ -71,6 +71,8 @@ public interface Manifest { */ Optional<ResourceTypeEnum> getType(); + boolean isSigned(); + /** * Gets the CMS manifest signature if present in manifest * @return diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java index bb0b07a63f..8e67d7b5de 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java @@ -80,7 +80,6 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { break; case NON_MANO_ARTIFACT_SETS: processNonManoArtifactEntry(); - continueToProcess = false; break; case SOURCE: processSource(); @@ -100,6 +99,9 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { Optional<String> currentLine = readNextNonEmptyLine(); while (currentLine.isPresent()) { final ManifestTokenType manifestTokenType = detectLineEntry().orElse(null); + if (manifestTokenType == ManifestTokenType.CMS_BEGIN) { + return; + } if (manifestTokenType != null) { reportError(Messages.MANIFEST_INVALID_NON_MANO_KEY, manifestTokenType.getToken()); continueToProcess = false; @@ -162,25 +164,35 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { */ private void readCmsSignature() { if (cmsSignature != null) { - reportError(Messages.MANIFEST_DUPLICATED_CMS_SIGNATURE); + reportError(Messages.MANIFEST_SIGNATURE_DUPLICATED); continueToProcess = false; return; } + final StringBuilder cmsSignatureBuilder = new StringBuilder(); + + cmsSignatureBuilder.append(currentLine).append("\n"); Optional<String> currentLine = readNextNonEmptyLine(); if(!getCurrentLine().isPresent()) { return; } - StringBuilder stringBuilder = new StringBuilder(); - while (currentLine.isPresent() && detectLineEntry().orElse(null) != ManifestTokenType.CMS_END) { - stringBuilder.append(currentLine.get()); - stringBuilder.append("\n"); + while (currentLine.isPresent()) { + if (detectLineEntry().orElse(null) == ManifestTokenType.CMS_END) { + cmsSignatureBuilder.append(currentLine.get()); + break; + } + cmsSignatureBuilder.append(currentLine.get()).append("\n"); currentLine = readNextNonEmptyLine(); } if (currentLine.isPresent()) { - cmsSignature = stringBuilder.toString(); + cmsSignature = cmsSignatureBuilder.toString(); readNextNonEmptyLine(); } + + if (getCurrentLine().isPresent()) { + reportError(Messages.MANIFEST_SIGNATURE_LAST_ENTRY); + continueToProcess = false; + } } /** |