Package javax.crypto.spec

Examples of javax.crypto.spec.DHParameterSpec


    SSLSocket ssl = null;
    SSLServerContext serverContext = new SSLServerContext();
    boolean generateDHParameters = false;     // use pre-generated Diffi-Hellman parameters

    DHParameterSpec dhparam = null;

    // pre-generated Diffi-Hellman parameters
    BigInteger p = new BigInteger("da583c16d9852289d0e4af756f4cca92dd4be533b804fb0fed94ef9c8a4403ed574650d36999db29d776276ba2d3d412e218f4dd1e084cf6d8003e7c4774e833", 16);
    BigInteger g = BigInteger.valueOf(2);
    dhparam = new DHParameterSpec(p, g);

    // set the DH parameter for empherial and anon cipher suites
    serverContext.setDHParameter(dhparam);
   
    KeyAndCertificate kac;
View Full Code Here


            {
                DHParameter dhP = new DHParameter((ASN1Sequence)aIn.readObject());

                if (dhP.getL() != null)
                {
                    currentSpec = new DHParameterSpec(dhP.getP(), dhP.getG(), dhP.getL().intValue());
                }
                else
                {
                    currentSpec = new DHParameterSpec(dhP.getP(), dhP.getG());
                }
            }
            catch (ClassCastException e)
            {
                throw new IOException("Not a valid DH Parameter encoding.");
View Full Code Here

            {
                return currentSpec;
            }
            else if (paramSpec == DHParameterSpec.class)
            {
                return new DHParameterSpec(currentSpec.getP(), currentSpec.getG());
            }

            throw new InvalidParameterSpecException("unknown parameter spec passed to ElGamal parameters object.");
        }
View Full Code Here

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

    JCEDHPrivateKey(
        DHPrivateKeySpec    spec)
    {
        this.x = spec.getX();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    }
View Full Code Here

        DERInteger      derX = (DERInteger)info.getPrivateKey();

        this.x = derX.getValue();
        if (params.getL() != null)
        {
            this.dhSpec = new DHParameterSpec(params.getP(), params.getG(), params.getL().intValue());
        }
        else
        {
            this.dhSpec = new DHParameterSpec(params.getP(), params.getG());
        }
    }
View Full Code Here

    JCEDHPrivateKey(
        DHPrivateKeyParameters  params)
    {
        this.x = params.getX();
        this.dhSpec = new DHParameterSpec(params.getParameters().getP(), params.getParameters().getG(), params.getParameters().getL());
    }
View Full Code Here

        ObjectInputStream   in)
        throws IOException, ClassNotFoundException
    {
        x = (BigInteger)in.readObject();

        this.dhSpec = new DHParameterSpec((BigInteger)in.readObject(), (BigInteger)in.readObject(), in.readInt());
    }
View Full Code Here

        return elSpec;
    }

    public DHParameterSpec getParams()
    {
        return new DHParameterSpec(elSpec.getP(), elSpec.getG());
    }
View Full Code Here

        {
            if (!(params instanceof DHParameterSpec))
            {
                throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
            }
            DHParameterSpec     dhParams = (DHParameterSpec)params;

            param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

            engine.init(param);
            initialised = true;
        }
View Full Code Here

TOP

Related Classes of javax.crypto.spec.DHParameterSpec

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.