Class KeyExchange

  • All Implemented Interfaces:
    Lifecycle
    Direct Known Subclasses:
    DH_KEY_EXCHANGE, SSL_KEY_EXCHANGE

    public abstract class KeyExchange
    extends Protocol
    Base class for protocols implementing key exchange: a secret key to be used for encryption is exchanged between 2 parties (usually the key server and a new cluster member) securely; ie. without the possibility of man-in-the-middle attacks, compromising the key and (optional) perfect forward secrecy.
    This protocol has to be placed somewhere below ASYM_ENCRYPT.
    Since:
    4.0.5
    Author:
    Bela Ban
    • Constructor Detail

      • KeyExchange

        public KeyExchange()
    • Method Detail

      • requiredUpServices

        public java.util.List<java.lang.Integer> requiredUpServices()
        Description copied from class: Protocol
        List of events that are required to be answered by some layer above
        Overrides:
        requiredUpServices in class Protocol
      • fetchSecretKeyFrom

        public abstract void fetchSecretKeyFrom​(Address target)
                                         throws java.lang.Exception
        Needs to fetch the secret key from a given destination (usually the key server). When received, the secret key (and version) needs to be installed in a protocol above using setSecretKeyAbove(Tuple).
        Parameters:
        target - The member from which to fetch the secret key
        Throws:
        java.lang.Exception
      • getServerLocation

        public abstract Address getServerLocation()
        Returns the address of the server, e.g. server socket (if any)
      • down

        public java.lang.Object down​(Event evt)
        Description copied from class: Protocol
        An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down().
        Overrides:
        down in class Protocol
      • handleView

        protected void handleView​(View view)
      • getSecretKeyFromAbove

        protected Tuple<javax.crypto.SecretKey,​byte[]> getSecretKeyFromAbove()
        Fetches the secret key from a protocol above us
        Returns:
        The secret key and its version
      • setSecretKeyAbove

        protected void setSecretKeyAbove​(Tuple<javax.crypto.SecretKey,​byte[]> key)
        Sets the secret key in a protocol above us
        Parameters:
        key - The secret key and its version
      • findProtocolAbove

        protected <T extends Protocol> T findProtocolAbove​(java.lang.Class<? extends Protocol> clazz)