allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
35
vendor/lcobucci/jwt/src/Signer/Rsa.php
vendored
Normal file
35
vendor/lcobucci/jwt/src/Signer/Rsa.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lcobucci\JWT\Signer;
|
||||
|
||||
use const OPENSSL_KEYTYPE_RSA;
|
||||
|
||||
abstract class Rsa extends OpenSSL
|
||||
{
|
||||
private const MINIMUM_KEY_LENGTH = 2048;
|
||||
|
||||
final public function sign(string $payload, Key $key): string
|
||||
{
|
||||
return $this->createSignature($key->contents(), $key->passphrase(), $payload);
|
||||
}
|
||||
|
||||
final public function verify(string $expected, string $payload, Key $key): bool
|
||||
{
|
||||
return $this->verifySignature($expected, $payload, $key->contents());
|
||||
}
|
||||
|
||||
final protected function guardAgainstIncompatibleKey(int $type, int $lengthInBits): void
|
||||
{
|
||||
if ($type !== OPENSSL_KEYTYPE_RSA) {
|
||||
throw InvalidKeyProvided::incompatibleKeyType(
|
||||
self::KEY_TYPE_MAP[OPENSSL_KEYTYPE_RSA],
|
||||
self::KEY_TYPE_MAP[$type],
|
||||
);
|
||||
}
|
||||
|
||||
if ($lengthInBits < self::MINIMUM_KEY_LENGTH) {
|
||||
throw InvalidKeyProvided::tooShort(self::MINIMUM_KEY_LENGTH, $lengthInBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user