Examples of RSAPrivateCrtKeyParameters


Examples of org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters

    BigInteger intPrimeQ = new BigInteger(primeQ);
    BigInteger intPrimeExponentP = new BigInteger(primeExponentP);
    BigInteger intPrimeExponentQ = new BigInteger(primeExponentQ);
    BigInteger intCrtCoefficient = new BigInteger(crtCoefficient);

    RSAPrivateCrtKeyParameters RSAprivKey =  new RSAPrivateCrtKeyParameters
            (intModulus, intPubExponent, intPrivExponent, intPrimeP,
            intPrimeQ, intPrimeExponentP, intPrimeExponentQ, intCrtCoefficient);
    byte[] toDecrypt = Hex.decode(input);
    cipher = new PKCS1Encoding(new RSAEngine());
    cipher.init(false, RSAprivKey);
View Full Code Here

Examples of org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters

        public KeyPair generateKeyPair()
        {
            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
            RSAKeyParameters            pub = (RSAKeyParameters)pair.getPublic();
            RSAPrivateCrtKeyParameters  priv = (RSAPrivateCrtKeyParameters)pair.getPrivate();

            return new KeyPair(new JCERSAPublicKey(pub),
                               new JCERSAPrivateCrtKey(priv));
        }
View Full Code Here

Examples of org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters

        dQ = d.remainder(qSub1);
        qInv = q.modInverse(p);

        return new AsymmetricCipherKeyPair(
                new RSAKeyParameters(false, n, e),
                new RSAPrivateCrtKeyParameters(n, e, d, p, q, dP, dQ, qInv));
    }
View Full Code Here

Examples of org.bouncycastle2.crypto.params.RSAPrivateCrtKeyParameters

    {
        if (key instanceof RSAPrivateCrtKey)
        {
            RSAPrivateCrtKey    k = (RSAPrivateCrtKey)key;

            return new RSAPrivateCrtKeyParameters(k.getModulus(),
                k.getPublicExponent(), k.getPrivateExponent(),
                k.getPrimeP(), k.getPrimeQ(), k.getPrimeExponentP(),                            k.getPrimeExponentQ(), k.getCrtCoefficient());
        }
        else
        {
View Full Code Here

Examples of org.bouncycastle2.crypto.params.RSAPrivateCrtKeyParameters

        public KeyPair generateKeyPair()
        {
            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
            RSAKeyParameters            pub = (RSAKeyParameters)pair.getPublic();
            RSAPrivateCrtKeyParameters  priv = (RSAPrivateCrtKeyParameters)pair.getPrivate();

            return new KeyPair(new JCERSAPublicKey(pub),
                               new JCERSAPrivateCrtKey(priv));
        }
View Full Code Here

Examples of org.bouncycastle2.crypto.params.RSAPrivateCrtKeyParameters

        dQ = d.remainder(qSub1);
        qInv = q.modInverse(p);

        return new AsymmetricCipherKeyPair(
                new RSAKeyParameters(false, n, e),
                new RSAPrivateCrtKeyParameters(n, e, d, p, q, dP, dQ, qInv));
    }
View Full Code Here

Examples of org.bouncycastle2.crypto.params.RSAPrivateCrtKeyParameters

        BigInteger input = core.convertInput(in, inOff, inLen);

        BigInteger result;
        if (key instanceof RSAPrivateCrtKeyParameters)
        {
            RSAPrivateCrtKeyParameters k = (RSAPrivateCrtKeyParameters)key;

            BigInteger e = k.getPublicExponent();
            if (e != null)   // can't do blinding without a public exponent
            {
                BigInteger m = k.getModulus();
                BigInteger r = BigIntegers.createRandomInRange(ONE, m.subtract(ONE), random);

                BigInteger blindedInput = r.modPow(e, m).multiply(input).mod(m);
                BigInteger blindedResult = core.processBlock(blindedInput);
View Full Code Here

Examples of org.bouncycastle2.crypto.params.RSAPrivateCrtKeyParameters

            //
            // we have the extra factors, use the Chinese Remainder Theorem - the author
            // wishes to express his thanks to Dirk Bonekaemper at rtsffm.com for
            // advice regarding the expression of this.
            //
            RSAPrivateCrtKeyParameters crtKey = (RSAPrivateCrtKeyParameters)key;

            BigInteger p = crtKey.getP();
            BigInteger q = crtKey.getQ();
            BigInteger dP = crtKey.getDP();
            BigInteger dQ = crtKey.getDQ();
            BigInteger qInv = crtKey.getQInv();

            BigInteger mP, mQ, h, m;

            // mP = ((input mod p) ^ dP)) mod p
            mP = (input.remainder(p)).modPow(dP, p);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.