public static HBCIPassportChipcard createPassport(DDVConfig config) throws ApplicationException, RemoteException
{
if (config == null)
throw new ApplicationException(i18n.tr("Keine Konfiguration ausgew�hlt"));
Type type = config.getReaderPreset().getType();
if (type.isPCSC())
{
String pcscName = config.getPCSCName();
Logger.info(" pcsc name: " + pcscName);
if (StringUtils.trimToNull(pcscName) != null)
{
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.NAME),pcscName);
}
}
else
{
//////////////////////////////////////////////////////////////////////////
// JNI-Treiber
String jni = getJNILib().getAbsolutePath();
Logger.info(" jni lib: " + jni);
HBCIUtils.setParam("client.passport.DDV.libname.ddv", jni);
//
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// CTAPI-Treiber
String ctapiDriver = config.getCTAPIDriver();
if (ctapiDriver == null || ctapiDriver.length() == 0)
throw new ApplicationException(i18n.tr("Kein CTAPI-Treiber in der Kartenleser-Konfiguration angegeben"));
File ctapi = new File(ctapiDriver);
if (!ctapi.exists() || !ctapi.isFile() || !ctapi.canRead())
throw new ApplicationException(i18n.tr("CTAPI-Treiber-Datei \"{0}\" nicht gefunden oder nicht lesbar",ctapiDriver));
Logger.info(" ctapi driver: " + ctapiDriver);
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.CTAPI), ctapiDriver);
//
//////////////////////////////////////////////////////////////////////////
}
//////////////////////////////////////////////////////////////////////////
// Passport-Verzeichnis
File f = new File(de.willuhn.jameica.hbci.Settings.getWorkPath() + "/passports/");
if (!f.exists())
f.mkdirs();
String headerName = type == Type.RDH_PCSC ? "RSA" : "DDV"; // siehe HBCIPassport[RSA/DDV], Konstruktor, "setParamHeader"
HBCIUtils.setParam("client.passport." + headerName + ".path",de.willuhn.jameica.hbci.Settings.getWorkPath() + "/passports/");
//
//////////////////////////////////////////////////////////////////////////
if (type.isCTAPI())
{
String port = Integer.toString(DDVConfig.getPortForName(config.getPort()));
Logger.info(" port: " + config.getPort() + " [ID: " + port + "]");
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.PORT), port);
Logger.info(" ctnumber: " + config.getCTNumber());
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.CTNUMBER), Integer.toString(config.getCTNumber()));
}
Logger.info(" soft pin: " + config.useSoftPin());
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.SOFTPIN), config.useSoftPin() ? "1" : "0");
Logger.info(" entry index: " + config.getEntryIndex());
HBCIUtils.setParam(PassportParameter.get(type,PassportParameter.ENTRYIDX), Integer.toString(config.getEntryIndex()));
String id = type.getIdentifier();
Logger.info(" passport type: " + id);
return (HBCIPassportChipcard) AbstractHBCIPassport.getInstance(id);
}