jwt icon indicating copy to clipboard operation
jwt copied to clipboard

Add Doc on pem path: have to be lke this `file://path/to/file.pem`

Open lacatoire opened this issue 1 year ago • 1 comments

In this file src/Signer/OpenSSL.php, at the validationProcess : return $this->validateKey(openssl_pkey_get_private($pem, $passphrase)); // also for the openssl_pkey_get_public

We should add in the documentation that the $pem have to be like this: file://path/to/file.pem with the file:// at the beginning, and an absolute path: Ex 'file:///app/config/jwt/private.pem' 'file:///app/config/jwt/public.pem'

For public & private keys

as detailed in the php page:

  • https://www.php.net/manual/en/function.openssl-pkey-get-public.php
  • https://www.php.net/manual/en/function.openssl-pkey-get-private.php

I've spent a bit of time on this, it could be useful to know for others !

lacatoire avatar Jun 24 '24 15:06 lacatoire

We don't promote the usage of the prefix as it can be error prone, instead we provide a method for creating your key object from a file path:

https://github.com/lcobucci/jwt/blob/871f751483551452fa4caaa14b01b15702d8752a/src/Signer/Key/InMemory.php#L48

You're right that we can improve the docs. Would you like to send a PR with a suggestion?

lcobucci avatar Jun 25 '24 05:06 lcobucci