Skip to content

Commit

Permalink
Test armor and unarmor
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Oct 12, 2022
1 parent 3a30e42 commit 8dfac4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/suite.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,15 @@ public function test000083002sig() {
$this->oneIssuer("000083-002.sig", "BD7BA7BC5547FD09");
}
}

class Armor extends TestCase {
public function testRoundTrip() {
$bytes = "abcd\0\xff";
$this->assertEquals($bytes, OpenPGP::unarmor(OpenPGP::enarmor($bytes), 'MESSAGE'));
}

public function testInvalidBase64() {
$input = OpenPGP::header('MESSAGE') . "\n\nY~WJjZAD/\n=PE3Q\n" . OpenPGP::footer('MESSAGE');
$this->assertEquals(false, OpenPGP::unarmor($input, 'MESSAGE'));
}
}

0 comments on commit 8dfac4b

Please sign in to comment.