Package org.bouncycastle.jce.spec

Examples of org.bouncycastle.jce.spec.ElGamalParameterSpec


            bcpgKey = new DSAPublicBCPGKey(dP.getP(), dP.getQ(), dP.getG(), dK.getY());
        }
        else if (pubKey instanceof ElGamalPublicKey)
        {
            ElGamalPublicKey        eK = (ElGamalPublicKey)pubKey;
            ElGamalParameterSpec    eS = eK.getParameters();
           
            bcpgKey = new ElGamalPublicBCPGKey(eS.getP(), eS.getG(), eK.getY());
        }
        else
        {
            throw new PGPException("unknown key class");
        }
View Full Code Here


               
                return fact.generatePublic(dsaSpec);
            case ELGAMAL_ENCRYPT:
            case ELGAMAL_GENERAL:
                ElGamalPublicBCPGKey    elK = (ElGamalPublicBCPGKey)publicPk.getKey();
                ElGamalPublicKeySpec    elSpec = new ElGamalPublicKeySpec(elK.getY(), new ElGamalParameterSpec(elK.getP(), elK.getG()));
               
                fact = KeyFactory.getInstance("ElGamal", provider);
               
                return fact.generatePublic(elSpec);
            default:
View Full Code Here

            BigInteger g = new BigInteger("153d5d6172adb43045b68ae8e1de1070b6137005686d29d3d73a7749199681ee5b212c9b96bfdcfa5b20cd5e3fd2044895d609cf9b410b7a0f12ca1cb9a428cc", 16);
            BigInteger p = new BigInteger("9494fec095f3b85ee286542b3836fc81a5dd0a0349b4c239dd38744d488cf8e31db8bcb7d33b41abb9e5a33cca9144b1cef332c94bf0573bf047a3aca98cdf3b", 16);

            KeyPairGenerator       kpg = KeyPairGenerator.getInstance("ElGamal", "BC");
           
            ElGamalParameterSpec   elParams = new ElGamalParameterSpec(p, g);
           
            kpg.initialize(elParams);
           
            KeyPair kp = kpg.generateKeyPair();
           
View Full Code Here

                return new PGPPrivateKey(fact.generatePrivate(dsaPrivSpec), this.getKeyID());
            case PGPPublicKey.ELGAMAL_ENCRYPT:
            case PGPPublicKey.ELGAMAL_GENERAL:
                ElGamalPublicBCPGKey    elPub = (ElGamalPublicBCPGKey)pubPk.getKey();
                ElGamalSecretBCPGKey    elPriv = new ElGamalSecretBCPGKey(in);
                ElGamalPrivateKeySpec   elSpec = new ElGamalPrivateKeySpec(elPriv.getX(), new ElGamalParameterSpec(elPub.getP(), elPub.getG()));
           
                fact = KeyFactory.getInstance("ElGamal", provider);
           
                return new PGPPrivateKey(fact.generatePrivate(elSpec), this.getKeyID());
            default:
View Full Code Here

            }
            else
            {
                DHParameterSpec s = (DHParameterSpec)paramSpec;
               
                this.currentSpec = new ElGamalParameterSpec(s.getP(), s.getG());
            }
        }
View Full Code Here

        {
            try
            {
                ElGamalParameter elP = new ElGamalParameter((ASN1Sequence)ASN1Object.fromByteArray(params));

                currentSpec = new ElGamalParameterSpec(elP.getP(), elP.getG());
            }
            catch (ClassCastException e)
            {
                throw new IOException("Not a valid ElGamal Parameter encoding.");
            }
View Full Code Here

                throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec or an ElGamalParameterSpec");
            }
           
            if (params instanceof ElGamalParameterSpec)
            {
                ElGamalParameterSpec     elParams = (ElGamalParameterSpec)params;

                param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(elParams.getP(), elParams.getG()));
            }
            else
            {
                DHParameterSpec     dhParams = (DHParameterSpec)params;
View Full Code Here

            }
            else
            {
                DHParameterSpec s = (DHParameterSpec)paramSpec;
               
                this.currentSpec = new ElGamalParameterSpec(s.getP(), s.getG());
            }
        }
View Full Code Here

            try
            {
                ElGamalParameter elP = new ElGamalParameter((ASN1Sequence)aIn.readObject());

                currentSpec = new ElGamalParameterSpec(elP.getP(), elP.getG());
            }
            catch (ClassCastException e)
            {
                throw new IOException("Not a valid ElGamal Parameter encoding.");
            }
View Full Code Here

                throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec or an ElGamalParameterSpec");
            }
           
            if (params instanceof ElGamalParameterSpec)
            {
                ElGamalParameterSpec     elParams = (ElGamalParameterSpec)params;

                param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(elParams.getP(), elParams.getG()));
            }
            else
            {
                DHParameterSpec     dhParams = (DHParameterSpec)params;
View Full Code Here

TOP

Related Classes of org.bouncycastle.jce.spec.ElGamalParameterSpec

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.