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

import java.security.Provider;
import java.security.Signature;

/**
 * @author Alex Uzun
 */
public class Signatures {

    public static Signature signatureFor(String algorithm, Object provider)
            throws Exception {
        return provider instanceof String
               ? Signature.getInstance(algorithm, (String) provider)
               : provider instanceof Provider ? Signature.getInstance(algorithm, (Provider) provider)
                                              : Signature.getInstance(algorithm);
    }

    private Signatures() {
        // empty
    }
}
