Android Open Source - CipherChat Session Key Reply Message






From Project

Back to project page CipherChat.

License

The source code is released under:

MIT License

If you think the Android project CipherChat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.desperate.common.replies;
/*  www . j a v a 2  s .  c  o  m*/
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;

import com.desperate.common.SessionKeyRequestInfo;
import com.desperate.common.Utilities;

/**
 * In the "Needham-Shroeder revisited" method lectured, represents the reply that KDC sends to A to get a session key to talk with B. Comes ciphered
 * with A's Key Encryption Key.
 * 
 * @author SIRS-RAR
 * 
 */
public class SessionKeyReplyMessage extends ReplyMessage {

  // Ea( Ra, B, Ks, Eb(A, Rb, Ks) )

  /**  */
  private static final long serialVersionUID = 7773927354068004172L;

  /**
   * Contains a #{@link com.desperate.common.SessionKeyRequestInfo SessionKeyRequestInfo} ciphered with the requester's KEK.
   */
  public byte[] cipheredPacket;

  public SessionKeyRequestInfo getInfo(SecretKeySpec key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException,
      InvalidAlgorithmParameterException, ClassNotFoundException, IOException {

    return (SessionKeyRequestInfo) Utilities.decipherObject(cipheredPacket, key);
  }

  @Override
  public String getStringToHMAC() {

    try {
      return timestamp + new String(cipheredPacket, Utilities.charset);

    } catch (UnsupportedEncodingException e) {

      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }

}




Java Source Code List

com.desperate.AdminConsole.java
com.desperate.ClientHandler.java
com.desperate.CryptoServer.java
com.desperate.UserDatabase.java
com.desperate.User.java
com.desperate.common.Message.java
com.desperate.common.NoncePacket.java
com.desperate.common.SessionKeyRequestInfo.java
com.desperate.common.TestCipherSerializable.java
com.desperate.common.Utilities.java
com.desperate.common.messages.ChatMessage.java
com.desperate.common.messages.IPMessage.java
com.desperate.common.messages.LoginMessage.java
com.desperate.common.messages.LogoutMessage.java
com.desperate.common.messages.RegisterMessage.java
com.desperate.common.messages.SessionKeyRequestMessage.java
com.desperate.common.messages.StartChatMessage.java
com.desperate.common.messages.UserListMessage.java
com.desperate.common.replies.CheckSessionMessage.java
com.desperate.common.replies.IPReplyMessage.java
com.desperate.common.replies.LoginReplyMessage.java
com.desperate.common.replies.LogoutReplyMessage.java
com.desperate.common.replies.NeedhamSchroederSuccessReply.java
com.desperate.common.replies.RegisterReplyMessage.java
com.desperate.common.replies.ReplyMessage.java
com.desperate.common.replies.SessionKeyReplyMessage.java
com.desperate.common.replies.StartChatReply.java
com.desperate.common.replies.UserListReplyMessage.java
com.desperate.debug.DebugClient.java
com.desperate.debug.DebugCryptoClient.java
com.desperate.debug.PlainServer.java
com.ist.cipherchat.gui.ChatActivity.java
com.ist.cipherchat.gui.ChooseServerActivity.java
com.ist.cipherchat.gui.Contacts.java
com.ist.cipherchat.gui.Origin.java
com.ist.cipherchat.networking.ChatActivityRunnable.java
com.ist.cipherchat.networking.ChatInRunnable.java
com.ist.cipherchat.networking.ChatOutHandler.java
com.ist.cipherchat.networking.Core.java
com.ist.cipherchat.networking.Globals.java
com.ist.cipherchat.networking.OutputSocketHandler.java
com.ist.cipherchat.networking.PhoneServerSocketHandler.java
com.ist.cipherchat.networking.ThreadComm.java