Package org.kapott.hbci.passport

Examples of org.kapott.hbci.passport.HBCIPassportInternal


        HBCIUtils.init(null,new HBCICallbackConsole());

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

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

        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());

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

        passportNew.saveChanges();

        passportOld.close();
        passportNew.close();           
    }
View Full Code Here


                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;
                }
            }
View Full Code Here

                searchString.append(".maxnum");
                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;
                }
            }
        }
       
View Full Code Here

                searchString.append(".minsigs");
                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;
                }
            }
        }
       
View Full Code Here

                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;
                }
            }
        }
       
View Full Code Here

        }
    }
   
    public void verifyConstraints()
    {
        HBCIPassportInternal passport=getMainPassport();
       
        // durch alle gespeicherten constraints durchlaufen
        for (Iterator<String> i=constraints.keySet().iterator();i.hasNext();) {
            // den frontendnamen f�r das constraint ermitteln
            String     frontendName=(i.next());
View Full Code Here

      if (logFilterLevel!=null && logFilterLevel.intValue()!=0) {
        LogFilter.getInstance().addSecretData(value,"X",logFilterLevel.intValue());
      }

        String[][]           destinations=constraints.get(paramName);
        HBCIPassportInternal passport=getMainPassport();
       
        if (destinations==null) {
            String msg=HBCIUtilsInternal.getLocMsg("EXCMSG_PARAM_NOTNEEDED",new String[] {paramName,getName()});
            if (!HBCIUtilsInternal.ignoreError(passport,"client.errors.ignoreWrongJobDataErrors",msg))
                throw new InvalidUserDataException(msg);
View Full Code Here

    }
   
    public boolean signIt()
    {
        boolean              ret=false;
        HBCIPassportInternal mainPassport=passports.getMainPassport();

        if (mainPassport.hasMySigKey()) {
            String msgName = msg.getName();
            MsgGen gen=handlerdata.getMsgGen();
            Node   msgNode = msg.getSyntaxDef(msgName, gen.getSyntax());
            String dontsignAttr = ((Element)msgNode).getAttribute("dontsign");

            if (dontsignAttr.length()==0) {
                try {
                    int numOfPassports=passports.size();
                   
                    // create an empty sighead and sigtail segment for each required signature
                    for (int idx=0;idx<numOfPassports;idx++) {
                        SEG sighead=SEGFactory.getInstance().createSEG("SigHeadUser","SigHead",msgName,numOfPassports-1-idx,gen.getSyntax());
                        SEG sigtail=SEGFactory.getInstance().createSEG("SigTailUser","SigTail",msgName,idx,gen.getSyntax());
                       
                        List<MultipleSyntaxElements> msgelements=msg.getChildContainers();
                        List<SyntaxElement> sigheads=((MultipleSEGs)(msgelements.get(1))).getElements();
                        List<SyntaxElement> sigtails=((MultipleSEGs)(msgelements.get(msgelements.size()-2))).getElements();

                        // insert sighead segment in msg
                        if ((numOfPassports-1-idx)<sigheads.size()) {
                            SEGFactory.getInstance().unuseObject(sigheads.get(numOfPassports-1-idx));
                        } else {
                            for (int i=sigheads.size()-1;i<numOfPassports-1-idx;i++) {
                                sigheads.add(null);
                            }
                        }
                        sigheads.set(numOfPassports-1-idx,sighead);
                       
                        // insert sigtail segment in message
                        if (idx<sigtails.size()) {
                            SEGFactory.getInstance().unuseObject(sigtails.get(idx));
                        } else {
                            for (int i=sigtails.size()-1;i<idx;i++) {
                                sigtails.add(null);
                            }
                        }
                        sigtails.set(idx,sigtail);
                    }
                   
                    // fill all sighead and sigtail segments
                    for (int idx=0;idx<numOfPassports;idx++) {
                        HBCIPassportInternal passport=passports.getPassport(idx);
                        String               role=passports.getRole(idx);
                       
                        setParam("secfunc",passport.getSigFunction());
                        setParam("cid",passport.getCID());
                        setParam("role",role);
                        setParam("range","1");
                        setParam("keyblz",passport.getBLZ());
                        setParam("keycountry",passport.getCountry());
                        setParam("keyuserid",passport.getMySigKeyName());
                        setParam("keynum",passport.getMySigKeyNum());
                        setParam("keyversion",passport.getMySigKeyVersion());
                        setParam("sysid",passport.getSysId());
                        setParam("sigid",passport.getSigId().toString());
                        setParam("sigalg",passport.getSigAlg());
                        setParam("sigmode",passport.getSigMode());
                        setParam("hashalg",passport.getHashAlg());
                        passport.incSigId();
                        passport.saveChanges();
                       
                        List<MultipleSyntaxElements> msgelements=msg.getChildContainers();
                        List<SyntaxElement> sigheads=((MultipleSEGs)(msgelements.get(1))).getElements();
                        List<SyntaxElement> sigtails=((MultipleSEGs)(msgelements.get(msgelements.size()-2))).getElements();

                        SEG sighead=(SEG)sigheads.get(numOfPassports-1-idx);
                        SEG sigtail=(SEG)sigtails.get(idx);
                       
                        fillSigHead(sighead);
                        fillSigTail(sighead,sigtail);
                    }
                    
                    msg.enumerateSegs(0,SyntaxElement.ALLOW_OVERWRITE);
                    msg.validate();
                    msg.enumerateSegs(1,SyntaxElement.ALLOW_OVERWRITE);

                    // calculate signatures for each segment
                    for (int idx=0;idx<numOfPassports;idx++) {
                        HBCIPassportInternal passport=passports.getPassport(idx);
                        List<MultipleSyntaxElements>                 msgelements=msg.getChildContainers();
                        List<SyntaxElement>                 sigtails=((MultipleSEGs)(msgelements.get(msgelements.size()-2))).getElements();
                        SEG                  sigtail=(SEG)sigtails.get(idx);

                        /* first calculate hash-result, then sign the hashresult. In
                         * most cases, the hash() step will be executed by the signature
                         * algorithm, so the hash() call returns the message as-is.
                         * Currently the only exception is PKCS#1-10, where an extra
                         * round of hashing must be executed before applying the
                         * signature process */
                        String hashdata=collectHashData(idx);
                        byte[] hashresult=passport.hash(hashdata.getBytes(Comm.ENCODING));
                        byte[] signature=passport.sign(hashresult);

                        if (passport.needUserSig()) {
                            String pintan=new String(signature,Comm.ENCODING);
                            int pos=pintan.indexOf("|");
                           
                            if (pos!=-1) {
                                // wenn �berhaupt eine signatur existiert
View Full Code Here

        // nationalen Kontoverbindung, verlangen sie anschliessend aber. Ein Fehler der
        // Bank. Siehe http://www.onlinebanking-forum.de/forum/topic.php?p=86444#real86444
        HBCIPassport passport = handler.getPassport();
        if (passport instanceof HBCIPassportInternal)
        {
            HBCIPassportInternal pi = (HBCIPassportInternal) passport;
            Object o = pi.getPersistentData("cannationalacc");
            if (o != null)
            {
                String s = o.toString();
                HBCIUtils.log("value of \"cannationalacc\" overwritten in passport, value: " + s,HBCIUtils.LOG_INFO);
                return s.equalsIgnoreCase("J");
View Full Code Here

        return ret;
    }

    private void readSigHead()
    {
        HBCIPassportInternal mainPassport=passports.getMainPassport();
        String               sigheadName=msg.getName()+".SigHead";
       
        u_secfunc=msg.getValueOfDE(sigheadName+".secfunc");

        // TODO: das ist abgeschaltet, weil das Thema "Sicherheitsfunktion, kodiert"
        // ab FinTS-3 anders behandelt wird - siehe Spez.
        /*
        if (u_secfunc.equals("2")) {
            // DDV
            u_cid=msg.getValueOfDE(sigheadName+".SecIdnDetails.cid");
            if (!u_cid.equals(mainPassport.getCID())) {
                String errmsg=HBCIUtilsInternal.getLocMsg("EXCMSG_CRYPTCIDFAIL");
                if (!HBCIUtilsInternal.ignoreError(null,"client.errors.ignoreSignErrors",errmsg))
                    throw new HBCI_Exception(errmsg);
            }
        } else {
            // RDH und PinTan (= 2 und 999)
            try {
                // falls noch keine system-id ausgehandelt wurde, so sendet der
                // hbci-server auch keine... deshalb der try-catch-block
                u_sysid=msg.getValueOfDE(sigheadName+".SecIdnDetails.sysid");
            } catch (Exception e) {
                u_sysid="0";
            }
        }
        */

        u_role = msg.getValueOfDE(sigheadName + ".role");
        u_range = msg.getValueOfDE(sigheadName + ".range");
        u_keycountry = msg.getValueOfDE(sigheadName + ".KeyName.KIK.country");
        u_keyuserid = msg.getValueOfDE(sigheadName + ".KeyName.userid");
        u_keynum = msg.getValueOfDE(sigheadName + ".KeyName.keynum");
        u_keyversion = msg.getValueOfDE(sigheadName + ".KeyName.keyversion");
        u_sigid = msg.getValueOfDE(sigheadName + ".secref");
        u_sigalg = msg.getValueOfDE(sigheadName + ".SigAlg.alg");
        u_sigmode = msg.getValueOfDE(sigheadName + ".SigAlg.mode");
        u_hashalg = msg.getValueOfDE(sigheadName + ".HashAlg.alg");

        // Die Angabe der BLZ ist nicht unbedingt verpflichtend (f�r 280 aber schon...). Trotzdem gibt es wohl
        // Banken die das nicht interessiert...
        try {
          u_keyblz = msg.getValueOfDE(sigheadName + ".KeyName.KIK.blz");
        }
        catch (Exception e) {
          HBCIUtils.log("missing bank code in message signature, ignoring...",HBCIUtils.LOG_WARN);
        }

        if (mainPassport.needUserSig()) {
            // TODO: bei anderen user-signaturen hier allgemeineren code schreiben
            Hashtable<String,String> values=new Hashtable<String, String>();
            msg.extractValues(values);
           
            String pin=values.get(msg.getName()+".SigTail.UserSig.pin");
View Full Code Here

TOP

Related Classes of org.kapott.hbci.passport.HBCIPassportInternal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.