Examples of generateKeyPair()


Examples of java.security.KeyPairGenerator.generateKeyPair()

        //
        // U side
        //
        KeyPair U1 = g.generateKeyPair();
        KeyPair U2 = g.generateKeyPair();

        KeyAgreement uAgree = KeyAgreement.getInstance("ECMQV", "BC");
        uAgree.init(new MQVPrivateKeySpec(U1.getPrivate(), U2.getPrivate(), U2.getPublic()));

        //
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.KeystoreInstance.generateKeyPair()

                throw new Exception("Key Algorithm '"+keyAlgorithm+"' is not supported.");
            }
            // Create a KeystoreInstance and generate keypair
            KeystoreInstance caKeystore = createCAKeystoreInstance(request, password, KeystoreUtil.defaultType);
            caKeystore.unlockKeystore(password.toCharArray());
            caKeystore.generateKeyPair(alias, password.toCharArray(), password.toCharArray(), keyAlgorithm, Integer.parseInt(keySize),
                    algorithm, 365, caCN, caOU, caO, caL, caST, caC);
            caKeystore.unlockPrivateKey(alias, password.toCharArray(), password.toCharArray());
           
            // Create CertificationAuthority, CertificateStore and CertificateRequestStore GBeans
            createCARelatedGBeans(request, (GeronimoManagedBean)caKeystore, defaultCAStoreDir, defaultCSRStoreDir);
View Full Code Here

Examples of org.apache.harmony.security.tests.support.MyKeyPairGenerator1.generateKeyPair()

        AlgorithmParameterSpec aps;
        KeyPairGenerator mKPG = new MyKeyPairGenerator1("");
        assertEquals("Incorrect algorithm", mKPG.getAlgorithm(),
                MyKeyPairGenerator1.getResAlgorithm());

        mKPG.generateKeyPair();
        mKPG.genKeyPair();

        for (int i = 0; i < keys.length; i++) {
            try {
                mKPG.initialize(keys[i]);
View Full Code Here

Examples of org.apache.harmony.security.tests.support.MyKeyPairGenerator2.generateKeyPair()

        SecureRandom random = new SecureRandom();
        KeyPairGenerator mKPG = new MyKeyPairGenerator2(null);
        assertEquals("Algorithm must be null", mKPG.getAlgorithm(),
                MyKeyPairGenerator2.getResAlgorithm());
        assertNull("genKeyPair() must return null", mKPG.genKeyPair());
        assertNull("generateKeyPair() mut return null", mKPG.generateKeyPair());
        for (int i = 0; i < keys.length; i++) {
            try {
                mKPG.initialize(keys[i]);
                fail("InvalidParameterException must be thrown (key: "
                        + Integer.toString(keys[i]) + ")");
View Full Code Here

Examples of org.apache.harmony.security.tests.support.MyKeyPairGeneratorSpi.generateKeyPair()

            fail("IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("Incorrect exception", e.getMessage(),
                    "Invalid random");
        }
        KeyPair kp = keyPairGen.generateKeyPair();
        assertNull("Not null KeyPair", kp);
    }
    public static void main(String args[]) {
        junit.textui.TestRunner.run(KeyPairGeneratorSpiTest.class);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.generators.DHBasicKeyPairGenerator.generateKeyPair()

    public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random,
                                                            DHParameters dhParams)
    {
        DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
        dhGen.init(new DHKeyGenerationParameters(random, dhParams));
        return dhGen.generateKeyPair();
    }

    public static DHPrivateKeyParameters generateEphemeralClientKeyExchange(SecureRandom random,
                                                                            DHParameters dhParams, OutputStream output)
        throws IOException
View Full Code Here

Examples of org.bouncycastle.crypto.generators.DHKeyPairGenerator.generateKeyPair()

     */
    public BigInteger calculateMessage()
    {
        DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
        dhGen.init(new DHKeyGenerationParameters(random, dhParams));
        AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

        this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

        return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
    }
View Full Code Here

Examples of org.bouncycastle.crypto.generators.DSAKeyPairGenerator.generateKeyPair()

        DSAKeyPairGenerator         dsaKeyGen = new DSAKeyPairGenerator();
        DSAKeyGenerationParameters  genParam = new DSAKeyGenerationParameters(keyRandom, params);

        dsaKeyGen.init(genParam);

        AsymmetricCipherKeyPair  pair = dsaKeyGen.generateKeyPair();

        ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), keyRandom);

        DSASigner dsa = new DSASigner();
View Full Code Here

Examples of org.bouncycastle.crypto.generators.ECKeyPairGenerator.generateKeyPair()

    {

        ECKeyPairGenerator keyPairGenerator = new ECKeyPairGenerator();
        ECKeyGenerationParameters keyGenerationParameters = new ECKeyGenerationParameters(ecParams, random);
        keyPairGenerator.init(keyGenerationParameters);
        return keyPairGenerator.generateKeyPair();
    }

    public static ECPublicKeyParameters validateECPublicKey(ECPublicKeyParameters key)
        throws IOException
    {
View Full Code Here

Examples of org.bouncycastle.crypto.generators.ElGamalKeyPairGenerator.generateKeyPair()

        kpGen.init(params);

        //
        // generate pair
        //
        AsymmetricCipherKeyPair         pair = kpGen.generateKeyPair();

        ElGamalPublicKeyParameters      pu = (ElGamalPublicKeyParameters)pair.getPublic();
        ElGamalPrivateKeyParameters     pv = (ElGamalPrivateKeyParameters)pair.getPrivate();

        ElGamalEngine    e = new ElGamalEngine();
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.