Ejemplo n.º 1
0
  /**
   * Erzeugt das Passport-Objekt.
   *
   * @throws Exception
   */
  @Before
  public void beforeTest() throws Exception {
    // Testdatei im Arbeitsverzeichnis - sollte in der Run-Konfiguration auf ein eigenes Verzeichnis
    // zeigen
    String workDir = System.getProperty("user.dir");
    InputStream in = new FileInputStream(workDir + "/DauerSEPAList.properties");
    params.load(in);

    settings.put(HBCICallback.NEED_BLZ, params.getProperty("blz"));
    settings.put(HBCICallback.NEED_CUSTOMERID, params.getProperty("customerid"));
    settings.put(HBCICallback.NEED_HOST, params.getProperty("host"));
    settings.put(HBCICallback.NEED_PT_PIN, params.getProperty("pin"));
    settings.put(HBCICallback.NEED_USERID, params.getProperty("userid"));
    settings.put(HBCICallback.NEED_PT_SECMECH, params.getProperty("secmech"));

    Properties props = new Properties();
    props.put("log.loglevel.default", Integer.toString(LOGLEVEL));
    props.put("infoPoint.enabled", Boolean.FALSE.toString());

    props.put(
        "client.passport.PinTan.filename",
        dir.getAbsolutePath() + File.separator + System.currentTimeMillis() + ".pt");
    props.put("client.passport.PinTan.init", "1");
    props.put(
        "client.passport.PinTan.checkcert",
        "0"); // Check der SSL-Zertifikate abschalten - brauchen wir nicht fuer den Test

    // falls noetig
    props.put("client.passport.PinTan.proxy", ""); // host:port
    props.put("client.passport.PinTan.proxyuser", "");
    props.put("client.passport.PinTan.proxypass", "");

    HBCICallback callback =
        new HBCICallbackConsole() {
          public void callback(
              HBCIPassport passport, int reason, String msg, int datatype, StringBuffer retData) {
            // haben wir einen vordefinierten Wert?
            String value = settings.get(reason);
            if (value != null) {
              retData.replace(0, retData.length(), value);
              return;
            }

            // Ne, dann an Super-Klasse delegieren
            super.callback(passport, reason, msg, datatype, retData);
          }
        };

    HBCIUtils.init(props, callback);
    this.passport = (HBCIPassportPinTan) AbstractHBCIPassport.getInstance("PinTan");

    // init handler
    this.handler = new HBCIHandler(params.getProperty("hbciversion"), passport);

    // dump bpd
    // this.dump("BPD",this.passport.getBPD());

    // Liste der unterstuetzten Geschaeftsvorfaelle ausgeben
    // this.dump("Supported GV",this.handler.getSupportedLowlevelJobs());
  }
Ejemplo n.º 2
0
  public static void main(String[] args) throws IOException {
    HBCIUtils.init(null, new HBCICallbackConsole());

    String nameOld = readParam(args, 0, "Filename of old RDH passport file");
    HBCIUtils.setParam("client.passport.RDH.filename", nameOld);
    HBCIUtils.setParam("client.passport.RDH.init", "1");
    HBCIPassportInternal passportOld =
        (HBCIPassportInternal) AbstractHBCIPassport.getInstance("RDH");

    String nameNew = readParam(args, 1, "Filename of new RDHNew passport file");
    HBCIUtils.setParam("client.passport.RDHNew.filename", nameNew);
    HBCIUtils.setParam("client.passport.RDHNew.init", "0");
    HBCIPassportInternal passportNew =
        (HBCIPassportInternal) AbstractHBCIPassport.getInstance("RDHNew");

    passportNew.setCountry(passportOld.getCountry());
    passportNew.setBLZ(passportOld.getBLZ());
    passportNew.setHost(passportOld.getHost());
    passportNew.setPort(passportOld.getPort());
    passportNew.setUserId(passportOld.getUserId());
    passportNew.setCustomerId(passportOld.getCustomerId());
    passportNew.setSysId(passportOld.getSysId());
    passportNew.setSigId(passportOld.getSigId());
    passportNew.setProfileVersion(passportOld.getProfileVersion());
    passportNew.setHBCIVersion(passportOld.getHBCIVersion());
    passportNew.setBPD(passportOld.getBPD());
    passportNew.setUPD(passportOld.getUPD());

    ((HBCIPassportRDHNew) passportNew)
        .setInstSigKey(((AbstractRDHSWPassport) passportOld).getInstSigKey());
    ((HBCIPassportRDHNew) passportNew)
        .setInstEncKey(((AbstractRDHSWPassport) passportOld).getInstEncKey());
    ((HBCIPassportRDHNew) passportNew)
        .setMyPublicSigKey(((AbstractRDHSWPassport) passportOld).getMyPublicSigKey());
    ((HBCIPassportRDHNew) passportNew)
        .setMyPrivateSigKey(((AbstractRDHSWPassport) passportOld).getMyPrivateSigKey());
    ((HBCIPassportRDHNew) passportNew)
        .setMyPublicEncKey(((AbstractRDHSWPassport) passportOld).getMyPublicEncKey());
    ((HBCIPassportRDHNew) passportNew)
        .setMyPrivateEncKey(((AbstractRDHSWPassport) passportOld).getMyPrivateEncKey());

    passportNew.saveChanges();

    passportOld.close();
    passportNew.close();
  }
Ejemplo n.º 3
0
  public static void main(String[] args) throws IOException {
    try {
      HBCIUtils.init(null, new MyCallback());
      readBasicParams();

      readPassportParams();
      passport = AbstractHBCIPassport.getInstance();

      readHBCIVersion();
      readActions();

      if (HBCIUtils.getParam("action.resetBPD").equals("1")) {
        passport.clearBPD();
      }
      if (HBCIUtils.getParam("action.resetUPD").equals("1")) {
        passport.clearUPD();
      }
      hbciHandle =
          new HBCIHandler(HBCIUtils.getParam("client.passport.hbciversion.default"), passport);

      /* HBCIExecStatus ret=hbciHandle.execute();
      System.out.println("ExecStatus");
      System.out.println(ret.toString());
      System.out.println("ExecStatusEnd");
      System.out.println("ExecStatusError");
      System.out.println(ret.getErrorString());
      System.out.println("ExecStatusErrorEnd"); */

      printSupportedGVs(hbciHandle);

      System.out.println();
      System.out.println("finished.");
      System.out.println();
    } finally {
      if (hbciHandle != null) {
        hbciHandle.close();
      } else if (passport != null) {
        passport.close();
      }
    }
  }