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

no.difi.asic.AsicVerifierFactory 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.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;

public class AsicVerifierFactory {

    public static AsicVerifierFactory newFactory() {
        return newFactory(MessageDigestAlgorithm.SHA256);
    }

    public static AsicVerifierFactory newFactory(SignatureMethod signatureMethod) {
        return newFactory(signatureMethod.getMessageDigestAlgorithm());
    }

    static AsicVerifierFactory newFactory(MessageDigestAlgorithm messageDigestAlgorithm) {
        return new AsicVerifierFactory(messageDigestAlgorithm);
    }

    private MessageDigestAlgorithm messageDigestAlgorithm;

    private AsicVerifierFactory(MessageDigestAlgorithm messageDigestAlgorithm) {
        this.messageDigestAlgorithm = messageDigestAlgorithm;
    }

    public AsicVerifier verify(File file) throws IOException {
        return verify(file.toPath());
    }

    public AsicVerifier verify(Path file) throws IOException {
        return verify(Files.newInputStream(file));
    }

    public AsicVerifier verify(InputStream inputStream) throws IOException {
        return new AsicVerifier(messageDigestAlgorithm, inputStream);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy