Package org.kapott.hbci.manager

Examples of org.kapott.hbci.manager.HBCIKey


                result="1";
                setProfileVersion(result);
                HBCIUtils.log("this is HBCI version '"+getHBCIVersion()+"', which only supports RDH-1", HBCIUtils.LOG_DEBUG);

            } else {
                HBCIKey key=getMyPublicSigKey();
                if (key!=null) {
                    // profil-erkennung anhand schluesselnummer
                    result=key.num;
        setProfileVersion(result);
                    HBCIUtils.log("using user sig key num '"+result+"' as profile version" ,HBCIUtils.LOG_DEBUG);
View Full Code Here


        for (Iterator<UserKeys> i=userkeys.iterator();i.hasNext();) {
            UserKeys key= i.next();
            if (key.getKeyType().equals(keytype)) {
                ret=new HBCIKey[2];
               
                ret[0]=new HBCIKey(
                    getCountry(),getBLZ(),getUserId(),
                    Integer.toString(key.getKeyNum()), Integer.toString(key.getKeyVersion()),
                    key.getPublicKey());
               
                ret[1]=new HBCIKey(
                    getCountry(),getBLZ(),getUserId(),
                    Integer.toString(key.getKeyNum()), Integer.toString(key.getKeyVersion()),
                    key.getPrivateKey());
            }
        }
View Full Code Here

                setCID((String)(o.readObject()));
                setHBCIVersion((String)o.readObject());
                setCustomerId((String)o.readObject());
               
                HBCIKey k=getMyPrivateSigKey();
                if (k!=null && k.key!=null && !(k.key instanceof RSAPrivateCrtKey)) {
                    HBCIUtils.log("private sig key is no CRT key, please contact the author!",HBCIUtils.LOG_WARN);
                }
               
                k=getMyPrivateEncKey();
View Full Code Here

            o.writeObject(getBPD());
            o.writeObject(getUPD());

            for (int i=0;i<3;i++) {
                for (int j=0;j<2;j++) {
                    HBCIKey key=getKey(i,j);

                    if (key!=null) {
                        o.writeObject(new HBCIKey(key.country,key.blz,key.userid,key.num,key.version,key.key));
                    }
                    else o.writeObject(null);
                }
            }

            o.writeObject(getCID());
            o.writeObject(getHBCIVersion());
            o.writeObject(getCustomerId());

            o.close();
            passportfile.delete();
            tempfile.renameTo(passportfile);

            HBCIKey k=getMyPrivateSigKey();
            if (k!=null && k.key!=null && !(k.key instanceof RSAPrivateCrtKey)) {
                HBCIUtils.log("private sig key is no CRT key, please contact the author!",HBCIUtils.LOG_WARN);
            }

            k=getMyPrivateEncKey();
View Full Code Here

            break;
        case 2:
            ret=2048;
            break;
        case 10:
            HBCIKey k=getInstSigKey();
            if (k==null) {
                k=getInstEncKey();
            }
            if (k!=null) {
                RSAPublicKey pkey=(RSAPublicKey)k.key;
View Full Code Here

                // die schl�ssell�nge ist vom sicherheitsprofil abh�ngig
                keygen.initialize(keySize);
                KeyPair pair=keygen.generateKeyPair();

                if (i==0) {
                    newSigKey[0]=new HBCIKey(country,blz,userid,num,version,pair.getPublic());
                    newSigKey[1]=new HBCIKey(country,blz,userid,num,version,pair.getPrivate());
                } else {
                    newEncKey[0]=new HBCIKey(country,blz,userid,num,version,pair.getPublic());
                    newEncKey[1]=new HBCIKey(country,blz,userid,num,version,pair.getPrivate());
                }
            }
        } catch (Exception ex) {
            throw new HBCI_Exception(HBCIUtilsInternal.getLocMsg("EXCMSG_GENKEYS_ERR"),ex);
        }
View Full Code Here

        setBankKey(account,"V",key);
    }
   
    private HBCIKey getBankKey(HBCIAccount account,String keytype)
    {
        HBCIKey ret=null;
        String  blz=account.getBLZ();
        String  country=account.getCountry();
       
        TLV[] keyfields=getFields(BankKeys.class);
        for (int i=0;i<keyfields.length;i++) {
View Full Code Here

        return (keytype==0)?"S":"V";
    }
   
    public HBCIKey getHBCIKey()
    {
        return new HBCIKey(
            countrycode,blz,keyname,
            Integer.toString(keynum),Integer.toString(keyversion),
            key);
    }
View Full Code Here

    }
   
    protected HBCIKey getElementKey(Element root,String owner,String type,String part)
        throws Exception
    {
        HBCIKey ret=null;
       
        NodeList keys=root.getElementsByTagName("key");
        int len=keys.getLength();
       
        for (int i=0;i<len;i++) {
            Node n=keys.item(i);
            if (n.getNodeType()==Node.ELEMENT_NODE) {
                Element keynode=(Element)n;
                if (keynode.getAttribute("owner").equals(owner) &&
                    keynode.getAttribute("type").equals(type) &&
                    keynode.getAttribute("part").equals(part)) {
               
                    Key key;
                   
                    if (part.equals("public")) {
                        RSAPublicKeySpec spec=new RSAPublicKeySpec(new BigInteger(getElementValue(keynode,"modulus")),
                                                                   new BigInteger(getElementValue(keynode,"exponent")));
                        key=KeyFactory.getInstance("RSA").generatePublic(spec);
                    } else {
                        String modulus=getElementValue(keynode,"modulus");
                        String privexponent=getElementValue(keynode,"exponent");
                        String pubexponent=getElementValue(keynode,"pubexponent");
                        String p=getElementValue(keynode,"p");
                        String q=getElementValue(keynode,"q");
                        String dP=getElementValue(keynode,"dP");
                        String dQ=getElementValue(keynode,"dQ");
                        String qInv=getElementValue(keynode,"qInv");
                       
                        if (privexponent==null) {
                            // only CRT
                            HBCIUtils.log("private "+type+" key is CRT-only",HBCIUtils.LOG_DEBUG);
                            key=new RSAPrivateCrtKey2(new BigInteger(p),
                                                      new BigInteger(q),
                                                      new BigInteger(dP),
                                                      new BigInteger(dQ),
                                                      new BigInteger(qInv));
                        } else if (p==null) {
                            // only exponent
                            HBCIUtils.log("private "+type+" key is exponent-only",HBCIUtils.LOG_DEBUG);
                            RSAPrivateKeySpec spec=new RSAPrivateKeySpec(new BigInteger(modulus),
                                                                         new BigInteger(privexponent));
                            key=KeyFactory.getInstance("RSA").generatePrivate(spec);
                        } else {
                            // complete data
                            HBCIUtils.log("private "+type+" key is fully specified",HBCIUtils.LOG_DEBUG);
                            RSAPrivateCrtKeySpec spec=new RSAPrivateCrtKeySpec(new BigInteger(modulus),
                                                                               new BigInteger(pubexponent),
                                                                               new BigInteger(privexponent),
                                                                               new BigInteger(p),
                                                                               new BigInteger(q),
                                                                               new BigInteger(dP),
                                                                               new BigInteger(dQ),
                                                                               new BigInteger(qInv));
                            key=KeyFactory.getInstance("RSA").generatePrivate(spec);
                        }
                    }
                   
                    ret=new HBCIKey(getElementValue(keynode,"country"),
                                    getElementValue(keynode,"blz"),
                                    getElementValue(keynode,"userid"),
                                    getElementValue(keynode,"keynum"),
                                    getElementValue(keynode,"keyversion"),
                                    key);
View Full Code Here

      this.setSigId(new Long(cardService.readSigId()));
     
      // readKeyData
      DDVKeyData[] keyData=cardService.readKeyData();
     
      this.setInstSigKey(new HBCIKey(
          getCountry(), getBLZ(), getUserId(),
          Integer.toString(keyData[0].num), Integer.toString(keyData[0].version),
          null));
     
      this.setInstEncKey(new HBCIKey(
          getCountry(), getBLZ(), getUserId(),
          Integer.toString(keyData[1].num), Integer.toString(keyData[1].version),
          null));
    }
View Full Code Here

TOP

Related Classes of org.kapott.hbci.manager.HBCIKey

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.