Package org.bouncycastle.crypto

Examples of org.bouncycastle.crypto.BasicAgreement


            AsymmetricCipherKeyPair  p2 = pGen.generateKeyPair();
       
            //
            // two way
            //
            BasicAgreement    e1 = new ECDHBasicAgreement();
            BasicAgreement    e2 = new ECDHBasicAgreement();

            e1.init(p1.getPrivate());
            e2.init(p2.getPrivate());

            BigInteger   k1 = e1.calculateAgreement(p2.getPublic());
            BigInteger   k2 = e2.calculateAgreement(p1.getPublic());

            if (!k1.equals(k2))
            {
                return new SimpleTestResult(false, this.getName() + ": calculated agreement test failed");
            }

            //
            // two way
            //
            e1 = new ECDHCBasicAgreement();
            e2 = new ECDHCBasicAgreement();

            e1.init(p1.getPrivate());
            e2.init(p2.getPrivate());

            k1 = e1.calculateAgreement(p2.getPublic());
            k2 = e2.calculateAgreement(p1.getPublic());

            if (!k1.equals(k2))
            {
                return new SimpleTestResult(false, this.getName() + ": calculated agreement test failed");
            }
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.BasicAgreement

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.