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

no.difi.asic.XadesAsicWriter Maven / Gradle / Ivy

Go to download

Generic implementation of ASiC-E archives in accordance with ETSI 102 918 v1.3.1.

There is a newer version: 0.12.0
Show newest version
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