All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithCAdESFromFiles Maven / Gradle / Ivy

Go to download

DSS ASiC with CAdES contains the code for the creation and validation of ASiC containers with CAdES signature(s).

There is a newer version: 6.0.d4j.2
Show newest version
package eu.europa.esig.dss.asic.signature.asics;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.asic.ASiCParameters;
import eu.europa.esig.dss.asic.signature.GetDataToSignASiCWithCAdESHelper;
import eu.europa.esig.dss.utils.Utils;

public class DataToSignASiCSWithCAdESFromFiles extends AbstractGetDataToSignASiCSWithCAdES implements GetDataToSignASiCWithCAdESHelper {

	private final List filesToBeSigned;
	private final Date signingDate;
	private final ASiCParameters asicParameters;

	private List signedDocuments;

	public DataToSignASiCSWithCAdESFromFiles(List filesToBeSigned, Date signingDate, ASiCParameters asicParameters) {
		this.filesToBeSigned = filesToBeSigned;
		this.signingDate = signingDate;
		this.asicParameters = asicParameters;
	}

	@Override
	public String getSignatureFilename() {
		return getSignatureFileName(asicParameters);
	}

	@Override
	public DSSDocument getToBeSigned() {
		return getSignedDocuments().get(0);
	}

	@Override
	public List getDetachedContents() {
		return Collections.emptyList();
	}

	@Override
	public List getSignedDocuments() {
		if (signedDocuments == null) {
			if (Utils.collectionSize(filesToBeSigned) > 1) {
				signedDocuments = Arrays.asList(createPackageZip(filesToBeSigned, signingDate));
			} else {
				signedDocuments = new ArrayList(filesToBeSigned);
			}
		}
		return signedDocuments;
	}

	@Override
	public List getManifestFiles() {
		// No manifest file in ASiC-S
		return Collections.emptyList();
	}

	@Override
	public List getSignatures() {
		// new container
		return new ArrayList();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy