Examples of doPhase()


Examples of javax.crypto.KeyAgreement.doPhase()

  public Key generateSecret()
    throws NoSuchAlgorithmException,
           InvalidKeyException {
    KeyAgreement ka = KeyAgreement.getInstance("DH");
    ka.init(keyPair.getPrivate());
    ka.doPhase(publicKey, true);
    return ka.generateSecret("DESede");
  }
 
  public EncryptionOptions getEncryptionOptions(
    Encryption enc)
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

        PublicKey publicKey = keyFactory.generatePublic(keySpec);

        KeyAgreement agreement = KeyAgreement.getInstance("DH");

        agreement.init(this.keys.getPrivate());
        agreement.doPhase(publicKey, true);

        byte[] secret = agreement.generateSecret();

        return Unpooled.wrappedBuffer(secret);
    }
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

        aliceKA.doPhase(bobPubK, true);

        // Bob uses Alice's public key for the first and only phase of his
        // version of the DH protocol
        harness.verbose("*** Bob does phase #1");
        bobKA.doPhase(alicePubK, true);

        // Both generate (hopefully) the same shared secret
        byte[] aliceSS = aliceKA.generateSecret();
        int len = aliceSS.length;

View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

                      "Shared secrets MUST be equal");

        harness.verbose("*** Bob generates a new shared secret");
        // The call to bobKA.generateSecret above resets the key-agreement
        // object, so we call doPhase() again before calling generateSecret()
        bobKA.doPhase(alicePubK, true);
        SecretKey bobSK = bobKA.generateSecret("DES");

        harness.verbose("*** Alice generates a new shared secret");
        aliceKA.doPhase(bobPubK, true);
        SecretKey aliceSK = aliceKA.generateSecret("DES");
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

        PublicKey vlPublic = this.getValueLinkPublicKey();

        // generate shared secret key
        KeyAgreement ka = KeyAgreement.getInstance("DH");
        ka.init(privateKey);
        ka.doPhase(vlPublic, true);
        byte[] secretKey = ka.generateSecret();

        if (debug) {
            Debug.log("Secret Key : " + StringUtil.toHexString(secretKey) + " / " + secretKey.length,  module);
        }
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

        PublicKey vlPublic = this.getValueLinkPublicKey();

        // generate shared secret key
        KeyAgreement ka = KeyAgreement.getInstance("DH");
        ka.init(privateKey);
        ka.doPhase(vlPublic, true);
        byte[] secretKey = ka.generateSecret();

        if (debug) {
            Debug.log("Secret Key : " + StringUtil.toHexString(secretKey) + " / " + secretKey.length,  module);
        }
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

            //
            // agreement
            //
            aKeyAgree.doPhase(bKeyPair.getPublic(), true);
            bKeyAgree.doPhase(aKeyPair.getPublic(), true);

            BigInteger  k1 = new BigInteger(aKeyAgree.generateSecret());
            BigInteger  k2 = new BigInteger(bKeyAgree.generateSecret());

            if (!k1.equals(k2))
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

            //
            // agreement
            //
            aKeyAgree.doPhase(bKeyPair.getPublic(), true);
            bKeyAgree.doPhase(aKeyPair.getPublic(), true);

            BigInteger  k1 = new BigInteger(aKeyAgree.generateSecret());
            BigInteger  k2 = new BigInteger(bKeyAgree.generateSecret());

            if (!k1.equals(k2))
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

            Key ac = aKeyAgree.doPhase(cPair.getPublic(), false);

            Key ba = bKeyAgree.doPhase(aPair.getPublic(), false);

            Key cb = cKeyAgree.doPhase(bPair.getPublic(), false);

            aKeyAgree.doPhase(cb, true);

            bKeyAgree.doPhase(ac, true);
View Full Code Here

Examples of javax.crypto.KeyAgreement.doPhase()

            aKeyAgree.doPhase(cb, true);

            bKeyAgree.doPhase(ac, true);

            cKeyAgree.doPhase(ba, true);

            BigInteger aShared = new BigInteger(aKeyAgree.generateSecret());
            BigInteger bShared = new BigInteger(bKeyAgree.generateSecret());
            BigInteger cShared = new BigInteger(cKeyAgree.generateSecret());
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.