Package org.kapott.cryptalgs

Examples of org.kapott.cryptalgs.RSAPrivateCrtKey2


        }
       
        public Key getPrivateKey()
        {
            try {
                RSAPrivateCrtKey2 k=new RSAPrivateCrtKey2(
                    new BigInteger(+1,p),
                    new BigInteger(+1,q),
                    new BigInteger(+1,dP),
                    new BigInteger(+1,dQ),
                    new BigInteger(+1,q).modInverse(new BigInteger(+1,p)));
                k.setAp(new BigInteger(+1,Ap));
                k.setAq(new BigInteger(+1,Aq));
                return k;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here


        public void setPrivateKey(Key key)
        {
            if (key instanceof RSAPrivateCrtKey2) {
                // gesetzter key wurde urspr�nglich auch aus einem SIZ-file gelesen
               
                RSAPrivateCrtKey2 privkey=(RSAPrivateCrtKey2)key;
                this.p=trimba(privkey.getP().toByteArray());
                this.q=trimba(privkey.getQ().toByteArray());
                this.dP=trimba(privkey.getdP().toByteArray());
                this.dQ=trimba(privkey.getdQ().toByteArray());
                this.Ap=trimba(privkey.getAp().toByteArray());
                this.Aq=trimba(privkey.getAq().toByteArray());
            } else {
                // key wurde mit Java erzeugt, es m�ssen noch ein paar Parameter,
                // die f�rs SIZ-file ben�tigt werden, errechnet werden
               
                RSAPrivateCrtKey privkey=(RSAPrivateCrtKey)key;
                this.p=trimba(privkey.getPrimeP().toByteArray());
                this.q=trimba(privkey.getPrimeQ().toByteArray());
                this.dP=trimba(privkey.getPrimeExponentP().toByteArray());
                this.dQ=trimba(privkey.getPrimeExponentQ().toByteArray());
               
                BigInteger one=new BigInteger("1");
                BigInteger modulus=new BigInteger(+1,this.p).multiply(new BigInteger(+1,this.q));
               
                this.Ap=trimba(new BigInteger(+1,this.q).modPow(new BigInteger(+1,this.p).subtract(one),modulus).toByteArray());
View Full Code Here

                        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) {
View Full Code Here

TOP

Related Classes of org.kapott.cryptalgs.RSAPrivateCrtKey2

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.