Skip to content

Commit 8dfac4b

Browse files
committed
Test armor and unarmor
1 parent 3a30e42 commit 8dfac4b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/suite.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,15 @@ public function test000083002sig() {
437437
$this->oneIssuer("000083-002.sig", "BD7BA7BC5547FD09");
438438
}
439439
}
440+
441+
class Armor extends TestCase {
442+
public function testRoundTrip() {
443+
$bytes = "abcd\0\xff";
444+
$this->assertEquals($bytes, OpenPGP::unarmor(OpenPGP::enarmor($bytes), 'MESSAGE'));
445+
}
446+
447+
public function testInvalidBase64() {
448+
$input = OpenPGP::header('MESSAGE') . "\n\nY~WJjZAD/\n=PE3Q\n" . OpenPGP::footer('MESSAGE');
449+
$this->assertEquals(false, OpenPGP::unarmor($input, 'MESSAGE'));
450+
}
451+
}

0 commit comments

Comments
 (0)