Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Nov 6, 2024
1 parent 102dc3c commit fd9d34d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/Common/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
final class Config
{
const VERSION = "PHP Privacy v2";
const COMMENT = "https://github.com/web-of-trust/php-privacy";
const COMMENT = "The PHP OpenPGP library";

const CIPHER_MODE = "cfb";
const HKDF_ALGO = "sha256";

const PADDING_MIN = 16;
const PADDING_MAX = 32;

const SALT_NOTATION = "[email protected]";

const AEAD_SUPPORTED = true;
const AEAD_CHUNK_SIZE_MIN = 10;
const AEAD_CHUNK_SIZE_MAX = 16;
Expand Down
3 changes: 1 addition & 2 deletions src/Key/AbstractKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace OpenPGP\Key;

use DateTimeInterface;
use OpenPGP\Common\Config;
use OpenPGP\Enum\{KeyAlgorithm, PacketTag, RevocationReasonTag, SignatureType};
use OpenPGP\Packet\{PacketList, Padding, Signature};
use OpenPGP\Packet\Signature\{
Expand Down Expand Up @@ -119,7 +118,7 @@ public function getPacketList(): PacketListInterface
];
if ($this->getVersion() === 6) {
$packets[] = Padding::createPadding(
random_int(Config::PADDING_MIN, Config::PADDING_MAX)
random_int(Padding::PADDING_MIN, Padding::PADDING_MAX)
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/Packet/Padding.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/
class Padding extends AbstractPacket
{
const PADDING_MIN = 16;
const PADDING_MAX = 32;

/**
* Constructor
*
Expand Down
2 changes: 1 addition & 1 deletion src/Packet/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static function createSignature(
$salt = Random::string($hashAlgorithm->saltSize());
} else {
$hashedSubpackets[] = Signature\NotationData::fromNotation(
Config::SALT_NOTATION,
NotationData::SALT_NOTATION,
Random::string($hashAlgorithm->saltSize())
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Packet/Signature/NotationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class NotationData extends SignatureSubpacket implements NotationDataInterface
const NAME_LENGTH = 2;
const VALUE_LENGTH = 2;

const SALT_NOTATION = "[email protected]";

/**
* Constructor
*
Expand Down

0 comments on commit fd9d34d

Please sign in to comment.