eu.europa.esig.dss.asic.signature.asics.DataToSignASiCSWithCAdESFromFiles Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dss-asic-cades Show documentation
Show all versions of dss-asic-cades Show documentation
DSS ASiC with CAdES contains the code for the creation and validation of ASiC containers with CAdES signature(s).
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();
}
}