code: public void proveIdentity(byte[] sharedSecret, KeyPair key) throws IOException, GeneralSecurityException {
          String algorithm = detectKeyAlgorithm(key);
          writeUTF(algorithm);
          writeKey(key.getPublic());
  
          Signature sig = Signature.getInstance("SHA1with"+algorithm);
          sig.initSign(key.getPrivate());
          sig.update(key.getPublic().getEncoded());
          sig.update(sharedSecret);
          writeObject(sig.sign());
      }
docs: Used in conjunction with {@link #verifyIdentity(byte[])} to prove
  that we actually own the private key of the given key pair.