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