/*
 * Copyright 2018 Scytl Secure Electronic Voting SA
 *
 * All rights reserved
 *
 * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
 */
package com.scytl.products.ov.sdm.domain.service.impl;

import java.security.SignatureException;
import java.security.cert.X509Certificate;

import com.scytl.cryptolib.elgamal.bean.ElGamalPublicKey;

/**
 * <p>
 * Validator for checking the signature of {@link ElGamalPublicKey} generated by
 * a control component.
 * <p>
 * Instances of this interface are thread-safe.
 */
public interface CCPublicKeySignatureValidator {
    /**
     * Checks the signature of given choice codes public key
     * 
     * @param signature
     *            the signature
     * @param certificateChain
     *            the certificate chain containing the public key to check the
     *            signature
     * @param key
     *            the key
     * @param electionEventId
     *            the election identifier
     * @param verificationCardSetId
     *            the verification card set identifier
     * @throws SignatureException
     *             the signature is invalid.
     */
    void checkChoiceCodesEncryptionKeySignature(byte[] signature,
            X509Certificate[] certificateChain, ElGamalPublicKey key,
            String electionEventId, String verificationCardSetId)
            throws SignatureException;

    /**
     * Checks the signature of given mixing public key.
     * 
     * @param signature
     *            the signature
     * @param certificateChain
     *            the certificate chain containing the public key to check the
     *            signature
     * @param key
     *            the key
     * @param electionEventId
     *            the election identifier
     * @param electoralAuthorityId
     *            the electoral authority identifier
     * @throws SignatureException
     *             the signature is invalid.
     */
    void checkMixingKeySignature(byte[] signature,
            X509Certificate[] certificateChain, ElGamalPublicKey key,
            String electionEventId, String electoralAuthorityId)
            throws SignatureException;
}
