-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in parsing USERID_HINT status causing missing real user name …
…in BadPassphrases array
- Loading branch information
Showing
2 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,8 +228,6 @@ public function testDecryptBadPassphraseException_missing() | |
*/ | ||
public function testDecryptBadPassphraseException_bad() | ||
{ | ||
$this->expectException('Crypt_GPG_BadPassphraseException'); | ||
|
||
// encrypted with [email protected] | ||
// {{{ encrypted data | ||
$encryptedData = <<<TEXT | ||
|
@@ -255,8 +253,21 @@ public function testDecryptBadPassphraseException_bad() | |
TEXT; | ||
// }}} | ||
|
||
$this->gpg->addDecryptKey('[email protected]', 'incorrect'); | ||
$this->gpg->decrypt($encryptedData); | ||
try { | ||
$this->gpg->addDecryptKey('[email protected]', 'incorrect'); | ||
$this->gpg->decrypt($encryptedData); | ||
} | ||
catch (\Crypt_GPG_BadPassphraseException $e) { | ||
$badKeys = $e->getBadPassphrases(); | ||
$missingKeys = $e->getMissingPassphrases(); | ||
|
||
$this->assertCount(1, $badKeys); | ||
$this->assertCount(0, $missingKeys); | ||
$this->assertSame( | ||
$badKeys[key($badKeys)], | ||
"First Keypair Test Key (do not encrypt important data with this key) <[email protected]>" | ||
); | ||
} | ||
} | ||
|
||
/** | ||
|