Skip to content

Import key with crypto in middleware.ts #66822

Answered by Chanizo
Chanizo asked this question in Help
Discussion options

You must be logged in to vote

Thank you for your answer @icyJoseph !
I tried jose and I have encountered same problem... but I found the the solution
In fact I was using basic ssh-keygen / openssl commands to generate a public / private key pair, but it was in format PKCS#1 by default. Jose and crypto libraries need more recent format, like PKCS#8 (private key) and SPKI (public key)

Related issue : panva/jose#345

Old commands :

openssl rsa -in my.key -pubout -outform PEM -out my.key.pub```

New commands :
```ssh-keygen -t rsa -b 4096 -m PKCS8 -f my.key -N ''
openssl pkey -in my.key -pubout -outform PEM -out my.key.pub```

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Chanizo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants