/** * @param string $message * @param string $signature * * @return GnupgVerificationResult * @throws VerificationFailedException */ public function verify($message, $signature) { try { $result = new GnupgVerificationResult($this->gpg->verify($message, $signature)[0]); if (!$result->wasVerificationSuccessful() && !$result->isKnownKey()) { $this->keyService->importKey($result->getFingerprint(), $this->keyService->downloadKey($result->getFingerprint())); } return new GnupgVerificationResult($this->gpg->verify($message, $signature)[0]); } catch (\Exception $e) { throw new VerificationFailedException($e->getMessage(), $e->getCode(), $e); } }
public function testGetFingerprint() { $result = new GnupgVerificationResult(['summary' => 128, 'fingerprint' => 'foo']); $this->assertSame('foo', $result->getFingerprint()); }