Package org.kapott.hbci.exceptions

Examples of org.kapott.hbci.exceptions.HBCI_Exception


    public byte[] encode(String st)
    {
        try {
            return HBCIUtils.encodeBase64(st.getBytes(Comm.ENCODING)).getBytes(Comm.ENCODING);
        } catch (Exception ex) {
            throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_B64ENCODEERR"),ex);
        }
    }
View Full Code Here


        try {
            Class cl=Class.forName("org.kapott.hbci.comm.Comm"+name);
            Constructor cons=cl.getConstructor(new Class[] {HBCIPassportInternal.class});
            return (Comm)cons.newInstance(new Object[] {passport});
        } catch (Exception e) {
            throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_CANTCREATECOMM",name),e);
        }
    }
View Full Code Here

                    }
                }
                ((GVRWPDepotUms)jobResult).addEntry(entry);
                buffer.delete(0,onerecord.length());
            } catch (Exception e) {
                throw new HBCI_Exception("*** error while extracting data",e);
            }
        }

        ((GVRWPDepotUms)jobResult).rest=buffer.toString();                   
    }         
View Full Code Here

                os.write(userkeys.getRawData());
            }
           
            setData(os.toByteArray());
        } catch (Exception e) {
            throw new HBCI_Exception(e);
        }
    }
View Full Code Here

                        msghead_st+=temp;
                    }
                    st=new StringBuffer(st).replace(0,idx,msghead_st).toString();
                }
            } catch (Exception ex) {
                throw new HBCI_Exception("*** error while fixing missing MsgRef",ex);
            }
        }
        return st;
    }
View Full Code Here

                    HBCIUtils.log(HBCIUtils.exception2String(e), HBCIUtils.LOG_DEBUG);
                }
               
                // TODO: hier auch gew�hltes pintan/verfahren lesen
            } catch (Exception e) {
                throw new HBCI_Exception("*** loading of passport file failed",e);
            }

            try {
                o.close();
            } catch (Exception e) {
View Full Code Here

            o.close();
            passportfile.delete();
            tempfile.renameTo(passportfile);
        } catch (Exception e) {
            throw new HBCI_Exception("*** saving of passport file failed",e);
        }
    }
View Full Code Here

                                                 HBCICallback.NEED_PT_PIN,
                                                 HBCIUtilsInternal.getLocMsg("CALLB_NEED_PTPIN"),
                                                 HBCICallback.TYPE_SECRET,
                                                 s);
                if (s.length()==0) {
                    throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_PINZERO"));
                }
                setPIN(s.toString());
                LogFilter.getInstance().addSecretData(getPIN(),"X",LogFilter.FILTER_SECRETS);
            }
           
            String tan="";
           
            // tan darf nur beim einschrittverfahren oder bei
            // PV=1 und passport.contains(challenge)           und tan-pflichtiger auftrag oder bei
            // PV=2 und passport.contains(challenge+reference) und HKTAN
            // ermittelt werden
           
            String pintanMethod=getCurrentTANMethod(false);

            if (pintanMethod.equals(Sig.SECFUNC_SIG_PT_1STEP)) {
                // nur beim normalen einschritt-verfahren muss anhand der segment-
                // codes ermittelt werden, ob eine tan ben�tigt wird
                HBCIUtils.log("onestep method - checking GVs to decide whether or not we need a TAN",HBCIUtils.LOG_DEBUG);
               
                // segment-codes durchlaufen
                String codes=collectSegCodes(new String(data,"ISO-8859-1"));
                StringTokenizer tok=new StringTokenizer(codes,"|");
               
                while (tok.hasMoreTokens()) {
                    String code=tok.nextToken();
                    String info=getPinTanInfo(code);
                   
                    if (info.equals("J")) {
                        // f�r dieses segment wird eine tan ben�tigt
                        HBCIUtils.log("the job with the code "+code+" needs a TAN",HBCIUtils.LOG_DEBUG);
                       
                        if (tan.length()==0) {
                            // noch keine tan bekannt --> callback
                           
                            StringBuffer s=new StringBuffer();
                            HBCIUtilsInternal.getCallback().callback(this,
                                HBCICallback.NEED_PT_TAN,
                                HBCIUtilsInternal.getLocMsg("CALLB_NEED_PTTAN"),
                                HBCICallback.TYPE_TEXT,
                                s);
                            if (s.length()==0) {
                                throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_TANZERO"));
                            }
                            tan=s.toString();
                        } else {
                            HBCIUtils.log("there should be only one job that needs a TAN!",HBCIUtils.LOG_WARN);
                        }
                       
                    } else if (info.equals("N")) {
                        HBCIUtils.log("the job with the code "+code+" does not need a TAN",HBCIUtils.LOG_DEBUG);
                       
                    } else if (info.length()==0) {
                        // TODO: ist das hier dann nicht ein A-Segment? In dem Fall
                        // w�re diese Warnung �berfl�ssig
                        HBCIUtils.log("the job with the code "+code+" seems not to be allowed with PIN/TAN",HBCIUtils.LOG_WARN);
                    }
                }
            } else {
                HBCIUtils.log("twostep method - checking passport(challenge) to decide whether or not we need a TAN",HBCIUtils.LOG_DEBUG);
                Properties secmechInfo=getCurrentSecMechInfo();
               
                // gespeicherte challenge aus passport holen
                String challenge=(String)getPersistentData("pintan_challenge");
                setPersistentData("pintan_challenge",null);
               
                // willuhn 2011-05-27 Wir versuchen, den Flickercode zu ermitteln und zu parsen
                String hhduc = (String) getPersistentData("pintan_challenge_hhd_uc");
                setPersistentData("pintan_challenge_hhd_uc",null); // gleich wieder aus dem Passport loeschen
                String flicker = parseFlickercode(challenge,hhduc);
               
                if (challenge==null) {
                    // es gibt noch keine challenge
                    HBCIUtils.log("will not sign with a TAN, because there is no challenge",HBCIUtils.LOG_DEBUG);
                } else {
                    HBCIUtils.log("found challenge in passport, so we ask for a TAN",HBCIUtils.LOG_DEBUG);
                    // es gibt eine challenge, also damit tan ermitteln
                   
                    // willuhn 2011-05-27: Flicker-Code uebergeben, falls vorhanden
                    // bei NEED_PT_SECMECH wird das auch so gemacht.
                    StringBuffer s = flicker != null ? new StringBuffer(flicker) : new StringBuffer();
                    HBCIUtilsInternal.getCallback().callback(this,
                        HBCICallback.NEED_PT_TAN,
                        secmechInfo.getProperty("name")+"\n"+secmechInfo.getProperty("inputinfo")+"\n\n"+challenge,
                        HBCICallback.TYPE_TEXT,
                        s);
                    if (s.length()==0) {
                        throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_TANZERO"));
                    }
                    tan=s.toString();
                }
            }
            if (tan.length()!=0) {
              LogFilter.getInstance().addSecretData(tan,"X",LogFilter.FILTER_SECRETS);
            }

            return (getPIN()+"|"+tan).getBytes("ISO-8859-1");
        } catch (Exception ex) {
            throw new HBCI_Exception("*** signing failed",ex);
        }
    }
View Full Code Here

        try {
            int padLength=plainMsg[plainMsg.length-1];
            byte[] encrypted=new String(plainMsg,0,plainMsg.length-padLength,"ISO-8859-1").getBytes("ISO-8859-1");
            return new byte[][] {new byte[8],encrypted};
        } catch (Exception ex) {
            throw new HBCI_Exception("*** encrypting message failed",ex);
        }
    }
View Full Code Here

    public byte[] decrypt(byte[] cryptedKey,byte[] cryptedMsg)
    {
        try {
            return new String(new String(cryptedMsg,"ISO-8859-1")+'\001').getBytes("ISO-8859-1");
        } catch (Exception ex) {
            throw new HBCI_Exception("*** decrypting of message failed",ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.kapott.hbci.exceptions.HBCI_Exception

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.