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

no.difi.asic.AbstractAsicManifest 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.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

abstract class AbstractAsicManifest {

    protected MessageDigestAlgorithm messageDigestAlgorithm;
    protected MessageDigest messageDigest;

    public AbstractAsicManifest(MessageDigestAlgorithm messageDigestAlgorithm) {
        this.messageDigestAlgorithm = messageDigestAlgorithm;

        // Create message digest
        try {
            messageDigest = MessageDigest.getInstance(messageDigestAlgorithm.getAlgorithm());
            messageDigest.reset();
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException(String.format("Algorithm %s not supported", messageDigestAlgorithm.getAlgorithm()), e);
        }
    }

    /**
     * @inheritDoc
     */
    public MessageDigest getMessageDigest() {
        messageDigest.reset();
        return messageDigest;
    }

    /**
     * @inheritDoc
     */
    public abstract void add(String filename, MimeType mimeType);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy