public function calculateSharedSecret(PublicKey $publicKey) : SharedSecret
    {
        $exchange = $this->getEccKey()->createExchange($publicKey->getEccKey());
        $binary = new BinaryString(gmp_export($exchange->calculateSharedKey()));

        return new SharedSecret($binary);
    }
public function calculateSharedSecret(PublicKey $publicKey) : SharedSecret
    {
        $exchange = $this->getEccKey()->createExchange($publicKey->getEccKey());
        $binary = new BinaryString(gmp_export($exchange->calculateSharedKey()));

        return new SharedSecret($binary);
    }
public function calculateSharedSecret ( PublicKey $ publicKey ) : SharedSecret { $ exchange = $ this -> getEccKey ( ) -> createExchange ( $ publicKey -> getEccKey ( ) ) ; $ binary = new BinaryString ( gmp_export ( $ exchange -> calculateSharedKey ( ) ) ) ; return new SharedSecret ( $ binary ) ; }
Calculate a shared secret.

@param PublicKey $publicKey The recipients public key.

@return SharedSecret
Calculate a shared secret .