mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-04-23 06:00:12 +00:00
[securemail] Upgrade Composer dependencies to fix PHP8 issue
- Upgrading phpseclib/phpseclib (2.0.4 => 2.0.34) - Upgrading singpolyma/openpgp-php (0.3.0 => 0.5.0)
This commit is contained in:
parent
fb77e3c5ea
commit
0c7fd9a34d
65 changed files with 5407 additions and 3230 deletions
21
securemail/vendor/singpolyma/openpgp-php/examples/armorEncryptSignCompress.php
vendored
Normal file
21
securemail/vendor/singpolyma/openpgp-php/examples/armorEncryptSignCompress.php
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
@include_once dirname(__FILE__).'/../vendor/autoload.php';
|
||||
require_once dirname(__FILE__).'/../lib/openpgp.php';
|
||||
require_once dirname(__FILE__).'/../lib/openpgp_crypt_rsa.php';
|
||||
|
||||
$recipientPublicKey = OpenPGP_Message::parse(OpenPGP::unarmor(file_get_contents('public.asc'), 'PGP PUBLIC KEY BLOCK'));
|
||||
|
||||
$encryptedPrivateKey = OpenPGP_Message::parse(OpenPGP::unarmor(file_get_contents('sekret.asc'), 'PGP PRIVATE KEY BLOCK'));
|
||||
$privateKeyPassphrase = 'test';
|
||||
$key = OpenPGP_Crypt_Symmetric::decryptSecretKey($privateKeyPassphrase, $encryptedPrivateKey[0]);
|
||||
|
||||
$signer = new OpenPGP_Crypt_RSA($key);
|
||||
$data = new OpenPGP_LiteralDataPacket("some text\n", ['format' => 'u']);
|
||||
$signed = $signer->sign($data);
|
||||
|
||||
$compressed = new OpenPGP_CompressedDataPacket($signed);
|
||||
$encrypted = OpenPGP_Crypt_Symmetric::encrypt([$recipientPublicKey, $key], new OpenPGP_Message([$compressed]));
|
||||
|
||||
echo OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE');
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue