__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace Jose\Component\Encryption\Algorithm\KeyEncryption;
use InvalidArgumentException;
use Jose\Component\Core\JWK;
use Jose\Component\Core\Util\RSAKey;
use Jose\Component\Encryption\Algorithm\KeyEncryption\Util\RSACrypt;
use function in_array;
abstract class RSA implements KeyEncryption
{
public function allowedKeyTypes(): array
{
return ['RSA'];
}
/**
* @param array<string, mixed> $completeHeader
* @param array<string, mixed> $additionalHeader
*/
public function encryptKey(JWK $key, string $cek, array $completeHeader, array &$additionalHeader): string
{
$this->checkKey($key);
$pub = RSAKey::toPublic(RSAKey::createFromJWK($key));
return RSACrypt::encrypt($pub, $cek, $this->getEncryptionMode(), $this->getHashAlgorithm());
}
/**
* @param array<string, mixed> $header
*/
public function decryptKey(JWK $key, string $encrypted_cek, array $header): string
{
$this->checkKey($key);
if (! $key->has('d')) {
throw new InvalidArgumentException('The key is not a private key');
}
$priv = RSAKey::createFromJWK($key);
return RSACrypt::decrypt($priv, $encrypted_cek, $this->getEncryptionMode(), $this->getHashAlgorithm());
}
public function getKeyManagementMode(): string
{
return self::MODE_ENCRYPT;
}
protected function checkKey(JWK $key): void
{
if (! in_array($key->get('kty'), $this->allowedKeyTypes(), true)) {
throw new InvalidArgumentException('Wrong key type.');
}
}
abstract protected function getEncryptionMode(): int;
abstract protected function getHashAlgorithm(): ?string;
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Util | Folder | 0775 |
|
|
| A128GCMKW.php | File | 287 B | 0664 |
|
| A128KW.php | File | 370 B | 0664 |
|
| A192GCMKW.php | File | 287 B | 0664 |
|
| A192KW.php | File | 370 B | 0664 |
|
| A256GCMKW.php | File | 287 B | 0664 |
|
| A256KW.php | File | 370 B | 0664 |
|
| AESGCMKW.php | File | 3.23 KB | 0664 |
|
| AESKW.php | File | 1.98 KB | 0664 |
|
| AbstractECDH.php | File | 10.81 KB | 0664 |
|
| AbstractECDHAESKW.php | File | 761 B | 0664 |
|
| Dir.php | File | 1.06 KB | 0664 |
|
| DirectEncryption.php | File | 395 B | 0664 |
|
| ECDHES.php | File | 212 B | 0664 |
|
| ECDHESA128KW.php | File | 418 B | 0664 |
|
| ECDHESA192KW.php | File | 418 B | 0664 |
|
| ECDHESA256KW.php | File | 418 B | 0664 |
|
| ECDHESAESKW.php | File | 1.52 KB | 0664 |
|
| ECDHSS.php | File | 1.05 KB | 0664 |
|
| ECDHSSA128KW.php | File | 418 B | 0664 |
|
| ECDHSSA192KW.php | File | 418 B | 0664 |
|
| ECDHSSA256KW.php | File | 476 B | 0664 |
|
| ECDHSSAESKW.php | File | 1.52 KB | 0664 |
|
| KeyAgreement.php | File | 660 B | 0664 |
|
| KeyAgreementWithKeyWrapping.php | File | 1.53 KB | 0664 |
|
| KeyEncryption.php | File | 973 B | 0664 |
|
| KeyWrapping.php | File | 996 B | 0664 |
|
| PBES2AESKW.php | File | 4.62 KB | 0664 |
|
| PBES2HS256A128KW.php | File | 510 B | 0664 |
|
| PBES2HS384A192KW.php | File | 510 B | 0664 |
|
| PBES2HS512A256KW.php | File | 510 B | 0664 |
|
| RSA.php | File | 1.71 KB | 0664 |
|
| RSA15.php | File | 460 B | 0664 |
|
| RSAOAEP.php | File | 464 B | 0664 |
|
| RSAOAEP256.php | File | 467 B | 0664 |
|