/** * @covers GPGMailer::sign() * @covers GPGMailer::verify() */ public function testSignedMessage() { // First, create a Zend\Mail message as usual: $message = new Message(); $message->addTo('*****@*****.**', 'GPGMailer Test Email'); $message->setBody('Cleartext for now. We are going to sign this.'); $privateKey = file_get_contents(__DIR__ . '/private.key'); // Instantiate GPGMailer: $gpgMailer = new GPGMailer(new File(), ['homedir' => '~'], $privateKey); $publicKey = file_get_contents(__DIR__ . '/public.key'); $signature = $gpgMailer->sign($message); $this->assertTrue(\strpos($signature->getBodyText(), '-----BEGIN PGP SIGNATURE-----') !== false); $fingerprint = $gpgMailer->import($publicKey); $this->assertTrue($gpgMailer->verify($signature, $fingerprint)); }