public int getSecurityClass() { int ret = 1; StringBuffer searchString = new StringBuffer(name); for (int i = searchString.length() - 1; i >= 0; i--) { if (!(searchString.charAt(i) >= '0' && searchString.charAt(i) <= '9')) { searchString.insert(i + 1, "Par"); searchString.append(".secclass"); break; } } HBCIPassportInternal passport = getMainPassport(); StringBuffer tempkey = new StringBuffer(); for (Enumeration i = passport.getBPD().propertyNames(); i.hasMoreElements(); ) { String key = (String) i.nextElement(); if (key.indexOf("Params") == 0) { tempkey.setLength(0); tempkey.append(key); tempkey.delete(0, tempkey.indexOf(".") + 1); if (tempkey.toString().equals(searchString.toString())) { ret = Integer.parseInt(passport.getBPD().getProperty(key)); break; } } } return ret; }
/* gibt den segmentcode für diesen job zurück */ public String getHBCICode() { StringBuffer ret = null; // Macht aus z.Bsp. "KUmsZeit5" -> "KUmsZeitPar5.SegHead.code" StringBuffer searchString = new StringBuffer(name); for (int i = searchString.length() - 1; i >= 0; i--) { if (!(searchString.charAt(i) >= '0' && searchString.charAt(i) <= '9')) { searchString.insert(i + 1, "Par"); searchString.append(".SegHead.code"); break; } } HBCIPassportInternal passport = getMainPassport(); StringBuffer tempkey = new StringBuffer(); // durchsuchen aller param-segmente nach einem job mit dem jobnamen des // aktuellen jobs for (Enumeration i = passport.getBPD().propertyNames(); i.hasMoreElements(); ) { String key = (String) i.nextElement(); if (key.indexOf("Params") == 0) { tempkey.setLength(0); tempkey.append(key); tempkey.delete(0, tempkey.indexOf(".") + 1); if (tempkey.toString().equals(searchString.toString())) { ret = new StringBuffer(passport.getBPD().getProperty(key)); ret.replace(1, 2, "K"); ret.deleteCharAt(ret.length() - 1); break; } } } return ret.toString(); }
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(); }