public function verifySignature($publicKey) 
    {
        $signature = $this->getSignature();
        $data = $this->getDataForSigning();
        
        if (!isset($signature)) {
            throw new \Exception("Missing signature");
        } elseif (1 != $result = openssl_verify($data, base64_decode ($signature), $publicKey)) {
            throw new \Exception("OpenSSL verification failed.");
        }
    }