[securemail] Upgrade singpolyma/openpgp to version 0.6.0

- Add missing use statement in SecureTestEmail
- Address https://github.com/friendica/friendica/issues/12011#issuecomment-1321196332
- phpseclib version 3 dependency is implied from the core so it is removed from the addon
This commit is contained in:
Hypolite Petovan 2022-11-23 12:25:10 -05:00
parent 30329df0dd
commit c18e0dc66a
60 changed files with 660 additions and 36426 deletions

View file

@ -64,8 +64,19 @@ class KeyVerification extends TestCase {
}
}
abstract class LibTestCase extends TestCase {
public function assertCast5Support() {
if(in_array('mcrypt', get_loaded_extensions())) {
return;
}
if(in_array('cast5-cfb', openssl_get_cipher_methods()) || in_array('CAST5-CFB', openssl_get_cipher_methods())) {
return;
}
$this->markTestSkipped('Not supported');
}
}
class Decryption extends TestCase {
class Decryption extends LibTestCase {
public function oneSymmetric($pass, $cnt, $path) {
$m = OpenPGP_Message::parse(file_get_contents(dirname(__FILE__) . '/data/' . $path));
$m2 = OpenPGP_Crypt_Symmetric::decryptSymmetric($pass, $m);
@ -82,6 +93,7 @@ class Decryption extends TestCase {
}
public function testDecryptCAST5() { // Requires mcrypt or openssl
$this->assertCast5Support();
$this->oneSymmetric("hello", "PGP\n", "symmetric-cast5.gpg");
}
@ -159,7 +171,7 @@ class Decryption extends TestCase {
}
}
class Encryption extends TestCase {
class Encryption extends LibTestCase {
public function oneSymmetric($algorithm) {
$data = new OpenPGP_LiteralDataPacket('This is text.', array('format' => 'u', 'filename' => 'stuff.txt'));
$encrypted = OpenPGP_Crypt_Symmetric::encrypt('secret', new OpenPGP_Message(array($data)), $algorithm);
@ -173,6 +185,7 @@ class Encryption extends TestCase {
}
public function testEncryptSymmetricCAST5() {
$this->assertCast5Support();
$this->oneSymmetric(3);
}