Examples of RSAPrivateCrtKeyParameters


Examples of com.googlecode.gwt.crypto.bouncycastle.params.RSAPrivateCrtKeyParameters

        if (components.length != 8) {
            throw new IllegalArgumentException("Serialized key is malformed");
        }
        // TODO evaluate, ensure adequate
        // "not really deprecated, just untested"
        return new RSAPrivateCrtKeyParameters(
                new BigInteger(new String(components[0])),
                new BigInteger(new String(components[1])),
                new BigInteger(new String(components[2])),
                new BigInteger(new String(components[3])),
                new BigInteger(new String(components[4])),
View Full Code Here

Examples of com.googlecode.gwt.crypto.bouncycastle.params.RSAPrivateCrtKeyParameters

    public static RSAPrivateCrtKeyParameters deserialize(String modulus, String publicExponent, String privateExponent,
                                                         String p, String q, String dP, String dQ, String qInv)
    {
        // "not really deprecated, just untested"
        return new RSAPrivateCrtKeyParameters(new BigInteger(modulus),
                new BigInteger(publicExponent),
                new BigInteger(privateExponent),
                new BigInteger(p),
                new BigInteger(q),
                new BigInteger(dP),
View Full Code Here

Examples of com.googlecode.gwt.crypto.bouncycastle.params.RSAPrivateCrtKeyParameters

        String decrypted = RSA.decrypt((RSAPrivateCrtKeyParameters) kp1.getPrivate(), encrypted);
        assertEquals(test, decrypted);

        String serialized = RSA.serialize((RSAPrivateCrtKeyParameters) kp1.getPrivate());
        RSAPrivateCrtKeyParameters priv2 = RSA.deserialize(serialized);

        String decrypted2 = RSA.decrypt(priv2, encrypted);
        assertEquals(test, decrypted2);
    }
View Full Code Here

Examples of com.googlecode.gwt.crypto.bouncycastle.params.RSAPrivateCrtKeyParameters

    }-*/;

    public void callback(String modulus, String publicExponent, String privateExponent,
                         String p, String q, String dP, String dQ, String qInv)
    {
        RSAPrivateCrtKeyParameters priv = RSA.deserialize(modulus, publicExponent, privateExponent,
                p, q, dP, dQ, qInv);
        RSAKeyParameters pub = new RSAKeyParameters(false, new BigInteger(modulus), new BigInteger(publicExponent));

        // TODO handle error from forge

View Full Code Here

Examples of org.bouncycastle.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

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.bouncycastle.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.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 BCRSAPublicKey(pub),
            new BCRSAPrivateCrtKey(priv));
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters

        if (algId.getAlgorithm().equals(PKCSObjectIdentifiers.rsaEncryption))
        {
            RSAPrivateKey keyStructure = RSAPrivateKey.getInstance(keyInfo.parsePrivateKey());

            return new RSAPrivateCrtKeyParameters(keyStructure.getModulus(),
                keyStructure.getPublicExponent(), keyStructure.getPrivateExponent(),
                keyStructure.getPrime1(), keyStructure.getPrime2(), keyStructure.getExponent1(),
                keyStructure.getExponent2(), keyStructure.getCoefficient());
        }
        // TODO?
View Full Code Here

Examples of org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters

     */
    public static PrivateKeyInfo createPrivateKeyInfo(AsymmetricKeyParameter privateKey) throws IOException
    {
        if (privateKey instanceof RSAKeyParameters)
        {
            RSAPrivateCrtKeyParameters priv = (RSAPrivateCrtKeyParameters)privateKey;

            return new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPrivateKey(priv.getModulus(), priv.getPublicExponent(), priv.getExponent(), priv.getP(), priv.getQ(), priv.getDP(), priv.getDQ(), priv.getQInv()));
        }
        else if (privateKey instanceof DSAPrivateKeyParameters)
        {
            DSAPrivateKeyParameters priv = (DSAPrivateKeyParameters)privateKey;
            DSAParameters params = priv.getParameters();

            return new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(params.getP(), params.getQ(), params.getG())), new ASN1Integer(priv.getX()));
        }
        else
        {
            throw new IOException("key parameters not recognised.");
        }
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.