NetDevPack / Security.Jwt

Jwt Manager. Set of components to deal with Jwt Stuff. Automate your key rotating, add support for jwks_uri. Store your cryptography keys in a secure place.
MIT License
271 stars 38 forks source link

How can I migrate an old ES256 key file to the database? #56

Closed l0gaw closed 5 months ago

l0gaw commented 7 months ago

I have a current key stored in the file format with the old alg ES256. Now the default is RSA. I'm trying to migrate from File store to the Database using EF but I wouldn't like my users to lose their current jwt. Is there a way to migrate the old key file to the database? The new keys would be generated using the alg RSA.

brunobritodev commented 5 months ago

Yes, but definetely will not a simple task. You need to inject FileSystemStore and IJsonWebKeyStore, then use FileSystemStore.GetCurrent() to get current Key, after that call IJsonWebKeyStore.Store().

Sure it helps