mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 17:08:48 +00:00
[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:
parent
30329df0dd
commit
c18e0dc66a
60 changed files with 660 additions and 36426 deletions
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.public_key
vendored
Normal file
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.public_key
vendored
Normal file
Binary file not shown.
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.secret_key
vendored
Normal file
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.secret_key
vendored
Normal file
Binary file not shown.
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.sig
vendored
Normal file
BIN
securemail/vendor/singpolyma/openpgp-php/tests/data/ed25519.sig
vendored
Normal file
Binary file not shown.
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
20
securemail/vendor/singpolyma/openpgp-php/tests/sodium_suite.php
vendored
Normal file
20
securemail/vendor/singpolyma/openpgp-php/tests/sodium_suite.php
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/* The tests which require phpseclib */
|
||||
|
||||
require_once dirname(__FILE__).'/../lib/openpgp.php';
|
||||
require_once dirname(__FILE__).'/../lib/openpgp_sodium.php';
|
||||
|
||||
class SodiumMessageVerification extends TestCase {
|
||||
public function oneMessageEdDSA($pkey, $path) {
|
||||
$pkeyM = OpenPGP_Message::parse(file_get_contents(dirname(__FILE__) . '/data/' . $pkey));
|
||||
$m = OpenPGP_Message::parse(file_get_contents(dirname(__FILE__) . '/data/' . $path));
|
||||
$verify = sodium_make_verifier($pkeyM);
|
||||
$this->assertSame($m->verified_signatures(array('EdDSA' => $verify)), $m->signatures());
|
||||
}
|
||||
|
||||
public function tested25519() {
|
||||
$this->oneMessageEdDSA('ed25519.public_key', 'ed25519.sig');
|
||||
}
|
||||
}
|
|
@ -374,6 +374,14 @@ class Serialization extends TestCase {
|
|||
public function testSymmetricNoMDC() {
|
||||
$this->oneSerialization("symmetric-no-mdc.gpg");
|
||||
}
|
||||
|
||||
public function tested25519_public() {
|
||||
$this->oneSerialization("ed25519.public_key");
|
||||
}
|
||||
|
||||
public function tested25519_secret() {
|
||||
$this->oneSerialization("ed25519.secret_key");
|
||||
}
|
||||
}
|
||||
|
||||
class Fingerprint extends TestCase {
|
||||
|
@ -405,6 +413,10 @@ class Fingerprint extends TestCase {
|
|||
public function test000082006public_key() {
|
||||
$this->oneFingerprint("000082-006.public_key", "589D7E6884A9235BBE821D35BD7BA7BC5547FD09");
|
||||
}
|
||||
|
||||
public function tested25519() {
|
||||
$this->oneFingerprint("ed25519.public_key", "88771946427EC2E24569C1D86208BE2B78C27E94");
|
||||
}
|
||||
}
|
||||
|
||||
class Signature extends TestCase {
|
||||
|
@ -425,3 +437,15 @@ class Signature extends TestCase {
|
|||
$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'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue