code: protected byte[] getPublicKey(KeyPair keyPair) {
          DHPublicKey incomingPublicKey = (DHPublicKey) keyPair.getPublic();
          BigInteger dhY = incomingPublicKey.getY();
          if (log.isDebugEnabled()) {
              log.debug("Public key: {}", Hex.encodeHexString(BigIntegers.asUnsignedByteArray(dhY)));
          }
          return Arrays.copyOfRange(BigIntegers.asUnsignedByteArray(dhY), 0, KEY_LENGTH);
      }
docs: Returns the public key for a given key pair.
  
  @param keyPair key pair
  @return public key