Skip to content

Commit 2362f23

Browse files
authored
Fix key derivation by removing curve size parameter from openssl_pkey_derive (#632)
Fix key derivation by removing curve size parameter from openssl_pkey_derive
1 parent cff939c commit 2362f23

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

phpstan-baseline.neon

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,7 @@ parameters:
23652365
path: src/Bundle/DependencyInjection/Source/NestedToken/NestedToken.php
23662366

23672367
-
2368-
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\NestedToken\\NestedTokenBuilder\:\:load\(\) expects array, mixed given\.$#'
2368+
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\NestedToken\\NestedTokenLoader\:\:load\(\) expects array, mixed given\.$#'
23692369
identifier: argument.type
23702370
count: 1
23712371
path: src/Bundle/DependencyInjection/Source/NestedToken/NestedToken.php
@@ -3798,6 +3798,12 @@ parameters:
37983798
count: 1
37993799
path: src/Bundle/Resources/config/Algorithms/signature_experimental.php
38003800

3801+
-
3802+
message: '#^Access to constant on internal class Jose\\Component\\Core\\Util\\Ecc\\NistCurve\.$#'
3803+
identifier: classConstant.internalClass
3804+
count: 1
3805+
path: src/Bundle/Resources/config/analyzers.php
3806+
38013807
-
38023808
message: '#^Method Jose\\Bundle\\JoseFramework\\Serializer\\JWEEncoder\:\:getRecipientIndex\(\) has parameter \$context with no value type specified in iterable type array\.$#'
38033809
identifier: missingType.iterableValue
@@ -5598,6 +5604,12 @@ parameters:
55985604
count: 1
55995605
path: src/Library/Signature/Algorithm/ECDSA.php
56005606

5607+
-
5608+
message: '#^Call to internal static method ParagonIE_Sodium_Core_Ed25519\:\:publickey_from_secretkey\(\)\.$#'
5609+
identifier: staticMethod.internal
5610+
count: 1
5611+
path: src/Library/Signature/Algorithm/EdDSA.php
5612+
56015613
-
56025614
message: '#^Method Jose\\Component\\Signature\\Algorithm\\RSAPKCS1\:\:sign\(\) should return string but returns mixed\.$#'
56035615
identifier: return.type

src/Bundle/DependencyInjection/JoseFrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use Override;
99
use Symfony\Component\Config\Definition\Processor;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
11-
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
1211
use Symfony\Component\DependencyInjection\Extension\Extension;
12+
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
1313
use function count;
1414

1515
final class JoseFrameworkExtension extends Extension implements PrependExtensionInterface

src/Library/Encryption/Algorithm/KeyEncryption/AbstractECDH.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function calculateAgreementKey(JWK $private_key, JWK $public_key): str
8989
$publicPem = ECKey::convertPublicKeyToPEM($public_key);
9090
$privatePem = ECKey::convertPrivateKeyToPEM($private_key);
9191

92-
$res = openssl_pkey_derive($publicPem, $privatePem, $curve->getSize());
92+
$res = openssl_pkey_derive($publicPem, $privatePem);
9393
if ($res === false) {
9494
throw new RuntimeException('Unable to derive the key');
9595
}

tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,8 @@ public function a256CBCHS512EncryptAndDecrypt(): void
320320
protected static function getMethod(string $class, string $name): ReflectionMethod
321321
{
322322
$class = new ReflectionClass($class);
323-
$method = $class->getMethod($name);
324-
$method->setAccessible(true);
325323

326-
return $method;
324+
return $class->getMethod($name);
327325
}
328326

329327
private function convertArrayToBinString(array $data): string

0 commit comments

Comments
 (0)