Java tutorial
//package com.java2s; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Signature; public class Main { static Signature getSignatureInstance(String algorithm) throws NoSuchAlgorithmException { return Signature.getInstance(algorithm); } static Signature getSignatureInstance(String algorithm, String provider) throws NoSuchProviderException, NoSuchAlgorithmException { if (provider != null) { return Signature.getInstance(algorithm, provider); } else { return Signature.getInstance(algorithm); } } }