code: protected void initRC4Encryption(byte[] sharedSecret) {
          log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret));
          // create output cipher
          log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey));
          byte[] rc4keyOut = new byte[32];
          // digest is 32 bytes, but our key is 16
          calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyOut, 0);
          log.debug("RC4 Out Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyOut, 0, 16)));
          try {
              cipherOut = Cipher.getInstance("RC4");
              cipherOut.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rc4keyOut, 0, 16, "RC4"));
          } catch (Exception e) {
              log.warn("Encryption cipher creation failed", e);
          }
          // create input cipher
          log.debug("Incoming public key [{}]: {}", incomingPublicKey.length, Hex.encodeHexString(incomingPublicKey));
          // digest is 32 bytes, but our key is 16
          byte[] rc4keyIn = new byte[32];
          calculateHMAC_SHA256(incomingPublicKey, 0, incomingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyIn, 0);
          log.debug("RC4 In Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyIn, 0, 16)));
          try {
              cipherIn = Cipher.getInstance("RC4");
              cipherIn.init(Cipher.DECRYPT_MODE, new SecretKeySpec(rc4keyIn, 0, 16, "RC4"));
          } catch (Exception e) {
              log.warn("Decryption cipher creation failed", e);
          }
      }
docs: Prepare the ciphers.
  
  @param sharedSecret shared secret byte sequence