no.difi.asic.XadesAsicWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-asic Show documentation
Show all versions of commons-asic Show documentation
Generic implementation of ASiC-E archives in accordance with ETSI 102 918 v1.3.1.
package no.difi.asic;
import java.io.IOException;
import java.io.OutputStream;
class XadesAsicWriter extends AbstractAsicWriter {
public XadesAsicWriter(SignatureMethod signatureMethod, OutputStream outputStream, boolean closeStreamOnClose) throws IOException {
super(outputStream, closeStreamOnClose, new XadesAsicManifest(signatureMethod.getMessageDigestAlgorithm()));
}
@Override
public AsicWriter setRootEntryName(String name) {
throw new IllegalStateException("ASiC-E XAdES does not support defining root file.");
}
@Override
void performSign(SignatureHelper signatureHelper) throws IOException {
// Generate and write manifest (META-INF/signatures.xml)
byte[] manifestBytes = ((XadesAsicManifest) asicManifest).toBytes(signatureHelper);
asicOutputStream.writeZipEntry("META-INF/signatures.xml", manifestBytes);
// System.out.println(new String(manifestBytes));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy