// Path: src/main/net/sf/portecle/FPortecle.java
// public static final ResourceBundle RB = ResourceBundle.getBundle(RB_BASENAME);
// 
// Path: src/main/net/sf/portecle/crypto/ProviderUtil.java
// public final class ProviderUtil
// {
// 	/**
// 	 * Private to prevent construction.
// 	 */
// 	private ProviderUtil()
// 	{
// 		// Nothing to do
// 	}
// 
// 	/**
// 	 * Get the PKCS #11 <code>Provider</code>s available on the system.
// 	 * 
// 	 * @return the (possibly empty) collection of available PKCS #11 <code>Provider</code>s
// 	 */
// 	public static Collection<Provider> getPkcs11Providers()
// 	{
// 		ArrayList<Provider> p11s = new ArrayList<>();
// 		for (Provider prov : Security.getProviders())
// 		{
// 			String pName = prov.getName();
// 			// Is it a PKCS #11 provider?
// 			/*
// 			 * TODO: is there a better way to find out? Could try instanceof sun.security.pkcs11.SunPKCS11 but that
// 			 * would require the class to be available?
// 			 */
// 			if (pName.startsWith("SunPKCS11-"))
// 			{
// 				p11s.add(prov);
// 			}
// 		}
// 		return p11s;
// 	}
// }


import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.sf.portecle.crypto.ProviderUtil;
import static net.sf.portecle.FPortecle.RB;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Window;
import java.security.Provider;
import java.security.Security;
import java.text.MessageFormat;
import java.util.TreeSet;
		JButton jbCancel = getCancelButton();

		JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
		jpButtons.add(jbOK);
		jpButtons.add(jbCancel);

		JPanel jpProvider = new JPanel(new FlowLayout(FlowLayout.CENTER));
		jpProvider.add(jlProvider);
		jpProvider.add(m_jcbProvider);
		jpProvider.setBorder(new EmptyBorder(5, 5, 5, 5));

		getContentPane().add(jpProvider, BorderLayout.CENTER);
		getContentPane().add(jpButtons, BorderLayout.SOUTH);

		getRootPane().setDefaultButton(providersAvailable ? jbOK : jbCancel);

		initDialog();
	}

	/**
	 * Check that the chosen provider is valid.
	 * 
	 * @return True if the provider is valid, false otherwise
	 */
	private boolean checkProvider()
	{
		String sProvider = (String) m_jcbProvider.getSelectedItem();

		if (sProvider == null || Security.getProvider(sProvider) == null)
		{
// Path: src/main/net/sf/portecle/FPortecle.java
// public static final ResourceBundle RB = ResourceBundle.getBundle(RB_BASENAME);
// 
// Path: src/main/net/sf/portecle/crypto/ProviderUtil.java
// public final class ProviderUtil
// {
// 	/**
// 	 * Private to prevent construction.
// 	 */
// 	private ProviderUtil()
// 	{
// 		// Nothing to do
// 	}
// 
// 	/**
// 	 * Get the PKCS #11 <code>Provider</code>s available on the system.
// 	 * 
// 	 * @return the (possibly empty) collection of available PKCS #11 <code>Provider</code>s
// 	 */
// 	public static Collection<Provider> getPkcs11Providers()
// 	{
// 		ArrayList<Provider> p11s = new ArrayList<>();
// 		for (Provider prov : Security.getProviders())
// 		{
// 			String pName = prov.getName();
// 			// Is it a PKCS #11 provider?
// 			/*
// 			 * TODO: is there a better way to find out? Could try instanceof sun.security.pkcs11.SunPKCS11 but that
// 			 * would require the class to be available?
// 			 */
// 			if (pName.startsWith("SunPKCS11-"))
// 			{
// 				p11s.add(prov);
// 			}
// 		}
// 		return p11s;
// 	}
// }


// Path: src/main/net/sf/portecle/DChoosePkcs11Provider.java
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.sf.portecle.crypto.ProviderUtil;
import static net.sf.portecle.FPortecle.RB;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Window;
import java.security.Provider;
import java.security.Security;
import java.text.MessageFormat;
import java.util.TreeSet;

		JButton jbCancel = getCancelButton();

		JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
		jpButtons.add(jbOK);
		jpButtons.add(jbCancel);

		JPanel jpProvider = new JPanel(new FlowLayout(FlowLayout.CENTER));
		jpProvider.add(jlProvider);
		jpProvider.add(m_jcbProvider);
		jpProvider.setBorder(new EmptyBorder(5, 5, 5, 5));

		getContentPane().add(jpProvider, BorderLayout.CENTER);
		getContentPane().add(jpButtons, BorderLayout.SOUTH);

		getRootPane().setDefaultButton(providersAvailable ? jbOK : jbCancel);

		initDialog();
	}

	/**
	 * Check that the chosen provider is valid.
	 * 
	 * @return True if the provider is valid, false otherwise
	 */
	private boolean checkProvider()
	{
		String sProvider = (String) m_jcbProvider.getSelectedItem();

		if (sProvider == null || Security.getProvider(sProvider) == null)
		{
			String msg = MessageFormat.format(RB.getString("DChoosePkcs11Provider.InvalidProvider.message"), sProvider);