/** * Get an instance of this class by giving the name of the PKCS#11 module; * e.g. "slbck.dll". * * @param pkcs11ModuleName * The name of the module; e.g. "slbck.dll". * @return An instance of Module that is connected to the given PKCS#11 * module. * @exception IOException * If connecting to the named module fails. * @preconditions (pkcs11ModuleName <> null) * and (pkcs11ModuleName is a valid PKCS#11 module name) * @postconditions */ public static Module getInstance(String pkcs11ModuleName) throws IOException { Util.requireNonNull("pkcs11ModuleName", pkcs11ModuleName); File file = new File(pkcs11ModuleName); if (!file.exists()) { throw new FileNotFoundException( "File " + pkcs11ModuleName + " does not exist"); } if (!file.isFile()) { throw new IOException(pkcs11ModuleName + " is not a file"); } if (!file.canRead()) { throw new IOException("Can not read file " + pkcs11ModuleName + ""); } return new Module(pkcs11ModuleName); }