Package tools.elgamal

Examples of tools.elgamal.ElgamalCipher


    }
    Object key = ChatterContext.get(getCk().getB(),
        PublicKeyRequest.PUBLIC_KEY);
    ChatterContext.put(getCk().getB(), SHARED_KEY, plainKey);
    try {
      Cipher elgamal = new ElgamalCipher();
      elgamal.init(Cipher.ENCRYPT_MODE, key);
      elgamal.update(plainKey);
      this.encryptedKey = elgamal.doFinal();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here


  public Message respond() {
    // Extract shared key from the encrypted message;
    PrivateKey key = ChatterContext.get(getCk().getA(),
        PublicKeyRequest.PRIVATE_KEY);
    try {
      Cipher elgamal = new ElgamalCipher();
      elgamal.init(Cipher.DECRYPT_MODE, key);
      elgamal.update(encryptedKey);
      byte[] sharedKey = elgamal.doFinal();
      ChatterContext.put(getCk().getA(), SHARED_KEY, sharedKey);
      return new ExchSharedKeyResponse(getTo(), getFrom());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here

TOP

Related Classes of tools.elgamal.ElgamalCipher

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.