I’m trying to validate an Apple Server Notification V2 (Sandbox) with a php library:
https://github.com/web-token/jwt-framework
Based on the documentation: https://web-token.spomky-labs.com/v/v2.x/the-components/signed-tokens-jws/jws-loading I thought this should do the job:
$jwt = 'eyJh...';
$jwk = JWKFactory::createFromCertificateFile('AppleRootCA-G3.cer');
$algorithmManager = new AlgorithmManager([
new ES256(),
]);
$jwsVerifier = new JWSVerifier(
$algorithmManager
);
$serializerManager = new JWSSerializerManager([
new CompactSerializer(),
]);
$jws = $serializerManager->unserialize($jwt);
$isVerified = $jwsVerifier->verifyWithKey($jws, $jwk, 0);
Still it doesn’t receive a positive verification. I’ve debugged it onto this point:
$result = openssl_verify($input, $der, $pem, $this->getHashAlgorithm());
Which will give false but no content in openssl_error_string()
Any suggestions?