Closed
Description
Describe the bug
When using JWKFactory::createOKPKey(Ed25519)
a 64 byte secret key is created. When used to sign a token, a SodiumException is thrown:
seed should be SODIUM_CRYPTO_SIGN_SEEDBYTES bytes
Note that the constant is defined as 32. Your tests for OKP creation and signing use a manually created 32 byte private key d
.
PHP Version: 7.3.2
To Reproduce
Steps to reproduce the behavior:
$key = JWKFactory::createOKPKey('Ed25519');
$algorithmManager = AlgorithmManager::create([new EdDSA()]);
$jwsBuilder = new JWSBuilder(new StandardConverter(), $algorithmManager);
$jwtSigned = $jwsBuilder
->create()
->withPayload('')
->addSignature(
$key,
[
'crit' => ['exp', 'aud'],
'alg' => ''EdDSA',
]
)
->build();
Expected behavior
The token to be signed.
Metadata
Metadata
Assignees
Labels
No labels