Package org.bouncycastle.crypto.agreement

Examples of org.bouncycastle.crypto.agreement.ECDHBasicAgreement.calculateAgreement()


    public static byte[] calculateECDHBasicAgreement(ECPublicKeyParameters publicKey, ECPrivateKeyParameters privateKey)
    {

        ECDHBasicAgreement basicAgreement = new ECDHBasicAgreement();
        basicAgreement.init(privateKey);
        BigInteger agreementValue = basicAgreement.calculateAgreement(publicKey);

        /*
         * RFC 4492 5.10. Note that this octet string (Z in IEEE 1363 terminology) as output by
         * FE2OSP, the Field Element to Octet String Conversion Primitive, has constant length for
         * any given field; leading zeros found in this octet string MUST NOT be truncated.
View Full Code Here


            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");
            }
View Full Code Here

            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
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.