package com.jscape.inet.ssh.protocol.v2.marshaling.keys;

import com.jscape.inet.ssh.protocol.v2.messages.Signature;
import com.jscape.util.SuppressObfuscation;

import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * @author Alex Usun
 */
public interface Signer {

    Signature sign(byte[] data, String publicKeyAlgorithm, PrivateKey key)
            throws Exception;

    void assertSignatureValid(byte[] data, PublicKey key, Signature signatureData)
            throws Exception;

    @SuppressObfuscation
    class InvalidSignatureException
            extends Exception {

        public InvalidSignatureException() {
            super("Invalid signature.");
        }
    }
}
