Package org.kapott.hbci.exceptions

Examples of org.kapott.hbci.exceptions.HBCI_Exception


        if (gvname==null || gvname.length()==0)
            throw new InvalidArgumentException(HBCIUtilsInternal.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
       
        String version=getSupportedLowlevelJobs().getProperty(gvname);
        if (version==null)
            throw new HBCI_Exception("*** lowlevel job "+gvname+" not supported");
       
        return kernel.getLowlevelJobResultNames(gvname,version);
    }
View Full Code Here


        if (gvname==null || gvname.length()==0)
            throw new InvalidArgumentException(HBCIUtilsInternal.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
       
        String version=getSupportedLowlevelJobs().getProperty(gvname);
        if (version==null)
            throw new HBCI_Exception("*** lowlevel job "+gvname+" not supported");
       
        return passport.getJobRestrictions(gvname,version);
    }
View Full Code Here

        try {
            Class cl=Class.forName("org.kapott.hbci.GV.GV"+jobnameHL);
            String lowlevelName=(String)cl.getMethod("getLowlevelName",(Class[])null).invoke(null,(Object[])null);
            return getSupportedLowlevelJobs().keySet().contains(lowlevelName);
        } catch (Exception e) {
            throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_HANDLER_HLCHECKERR",jobnameHL),e);
        }
    }
View Full Code Here

        {
          throw e1;
        }
        catch (Exception e)
        {
          throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_PASSPORT_INSTDATAERR"),e);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // read passport file
        String path = HBCIUtils.getParam(getParamHeader()+".path","./");
        this.setFileName(HBCIUtilsInternal.withCounter(path+"pcsc"+getCardId(),getEntryIdx()-1));
        HBCIUtils.log("loading passport data from file "+getFileName(),HBCIUtils.LOG_DEBUG);
       
        File file = new File(this.getFileName());
        if (file.exists() && file.isFile() && file.canRead())
        {
          int retries = Integer.parseInt(HBCIUtils.getParam("client.retries.passphrase","3"));

          while (true) // loop for entering the correct passphrase
          {
            if (this.getPassportKey() == null)
              this.setPassportKey(calculatePassportKey(FOR_LOAD));

            PBEParameterSpec paramspec = new PBEParameterSpec(CIPHER_SALT,CIPHER_ITERATIONS);
            Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
            cipher.init(Cipher.DECRYPT_MODE,getPassportKey(),paramspec);
             
            try
            {
              is = new ObjectInputStream(new CipherInputStream(new FileInputStream(file),cipher));
            }
            catch (StreamCorruptedException e1)
            {
              setPassportKey(null); // Passwort resetten
              retries--;
              if (retries<=0)
                throw new InvalidPassphraseException();
            }
            catch (Exception e2)
            {
              throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_PASSPORT_READERR"),e2);
            }
           
            // wir habens
            if (is != null)
            {
              setBPD((Properties)(is.readObject()));
              setUPD((Properties)(is.readObject()));
              setHBCIVersion((String)is.readObject());
              break;
            }
          }
        }
        //
        ////////////////////////////////////////////////////////////////////////
      }
      catch (Exception e)
      {
        // Im Fehlerfall wieder schliessen
        try {
          closeCT();
        }
        catch (Exception ex) {
          HBCIUtils.log(ex);
        }
       
        if (e instanceof HBCI_Exception)
          throw (HBCI_Exception) e;
       
        throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_CTERR"),e);
      }
      finally
      {
        // Close Passport-File
        if (is != null) {
View Full Code Here

      try
      {
        TerminalFactory terminalFactory = TerminalFactory.getDefault();
        CardTerminals terminals = terminalFactory.terminals();
        if (terminals == null)
          throw new HBCI_Exception("Kein Kartenleser gefunden");
       
        List<CardTerminal> list = terminals.list();
        if (list == null || list.size() == 0)
          throw new HBCI_Exception("Kein Kartenleser gefunden");
       
        HBCIUtils.log("found card terminals:",HBCIUtils.LOG_INFO);
        for (CardTerminal t:list) {
            HBCIUtils.log("  "+t.getName(),HBCIUtils.LOG_INFO);
        }

        CardTerminal terminal = null;

        // Checken, ob der User einen konkreten Kartenleser vorgegeben hat
        String name = HBCIUtils.getParam(getParamHeader()+".pcsc.name",null);
        if (name != null)
        {
          HBCIUtils.log("explicit terminal name given, trying to open terminal: " + name,HBCIUtils.LOG_DEBUG);
          terminal = terminals.getTerminal(name);
          if (terminal == null)
            throw new HBCI_Exception("Kartenleser \"" + name + "\" nicht gefunden");
        }
        else
        {
          HBCIUtils.log("open first available card terminal",HBCIUtils.LOG_DEBUG);
          terminal = list.get(0);
        }
        HBCIUtils.log("using card terminal " + terminal.getName(),HBCIUtils.LOG_DEBUG);

        // wait for card
        if (!terminal.waitForCardPresent(60 * 1000L))
          throw new HBCI_Exception("Keine Chipkarte in Kartenleser " + terminal.getName() + " gefunden");

        // Hier kann man gemaess
        // http://download.oracle.com/javase/6/docs/jre/api/security/smartcardio/spec/javax/smartcardio/CardTerminal.html#connect%28java.lang.String%29
        // auch "T=0" oder "T=1" angeben. Wir wissen allerdings noch nicht, von welchem
        // Typ die Karte ist. Daher nehmen wir "*" fuer jedes verfuegbare. Wenn wir die
        // Karte geoeffnet haben, kriegen wir dann auch das Protokoll raus.
        this.smartCard = terminal.connect("*");
        String type = this.smartCard.getProtocol();
        HBCIUtils.log(" card type: " + type,HBCIUtils.LOG_INFO);
       
        // Card-Service basierend auf dem Kartentyp erzeugen
        if (type == null || type.indexOf("=") == -1)
          throw new HBCI_Exception("Unbekannter Kartentyp");

        String id = type.substring(type.indexOf("=")+1);
        String serviceName = "org.kapott.hbci.smartcardio.DDVCardService" + id;
        HBCIUtils.log(" trying to load: " + serviceName,HBCIUtils.LOG_DEBUG);
        this.cardService = (DDVCardService) Class.forName(serviceName).newInstance();
        HBCIUtils.log(" using: " + this.cardService.getClass().getName(),HBCIUtils.LOG_INFO);
        this.cardService.init(this.smartCard);
       
        // getCID
        byte[] cid=this.cardService.getCID();
        this.setCID(new String(cid,"ISO-8859-1"));
       
        // extract card id
        StringBuffer cardId=new StringBuffer();
        for (int i=0;i<8;i++)
        {
          cardId.append((char)(((cid[i+1]>>4)&0x0F) + 0x30));
          cardId.append((char)((cid[i+1]&0x0F) + 0x30));
        }
        this.setCardId(cardId.toString());
      }
      catch (HBCI_Exception he)
      {
        throw he;
      }
      catch (Exception e)
      {
        throw new HBCI_Exception(e);
      }
    }
View Full Code Here

      {
        throw e1;
      }
      catch (Exception e2)
      {
        throw new HBCI_Exception(e2);
      }
    }
View Full Code Here

                        if (f.isFile() && f.canRead())
                            source = new StreamSource(f);
                    }

                    if (source == null)
                        throw new HBCI_Exception("schema validation activated against " + file + " - but schema file could not be found");

                    LOG.fine("activating schema validation against " + file);
                    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                    Schema schema = schemaFactory.newSchema(source);
                    marshaller.setSchema(schema);
View Full Code Here

        try {
            Field field=this.getClass().getDeclaredField("u_"+name);
            HBCIUtils.log("setting "+name+" to "+value,HBCIUtils.LOG_DEBUG);
            field.set(this,value);
        } catch (Exception ex) {
            throw new HBCI_Exception("*** error while setting parameter",ex);
        }
    }
View Full Code Here

            }
            ret.append((char)(padLength));

            return ret.toString().getBytes(Comm.ENCODING);
        } catch (Exception ex) {
            throw new HBCI_Exception("*** error while extracting plain message string",ex);
        }
    }
View Full Code Here

                    newmsg.propagateValue(newmsg.getPath()+".MsgTail.SegHead.seq",segnum,
                            SyntaxElement.DONT_TRY_TO_CREATE,
                            SyntaxElement.ALLOW_OVERWRITE);
                    newmsg.autoSetMsgSize(gen);
                } catch (Exception ex) {
                    throw new HBCI_Exception("*** error while encrypting",ex);
                }
            }
            else HBCIUtils.log("did not encrypt - message does not want to be encrypted",HBCIUtils.LOG_DEBUG);
        }
        else HBCIUtils.log("can not encrypt - no encryption key available",HBCIUtils.LOG_WARN);
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.