Update docs for RSA signing/verification

This commit is contained in:
Vincent Prouillet 2018-10-15 13:26:03 +02:00
parent 4a5d69bdc0
commit e725bea1d2
3 changed files with 11 additions and 23 deletions

View File

@ -108,7 +108,9 @@ This library currently supports the following:
### RSA
`jsonwebtoken` can only read DER encoded keys currently. If you have openssl installed,
you can run the following commands to obtain the DER keys from .pem:
you can run the following commands to obtain the DER keys from PKCS#1 (ie with `BEGIN RSA PUBLIC KEY`) .pem.
If you have a PKCS#8 pem file (ie starting with `BEGIN PUBLIC KEY`), you will need to first convert it to PKCS#1:
`openssl rsa -pubin -in <filename> -RSAPublicKey_out -out <filename>`.
```bash
// private key

View File

@ -1,22 +0,0 @@
# Generating RSA keys
Using `openssl`
## PEM
`openssl genrsa -out private_rsa_key.pem 2048`
Getting public key:
`openssl rsa -in private_rsa_key.pem -outform PEM -pubout -out public_rsa_key.pem`
## DER
Same as PEM but replace `PEM` by `DER`.
`openssl rsa -in private_rsa_key.pem -outform DER -pubout -out public_rsa_key.der`
## Converting private PEM to DER
`openssl rsa -in private_rsa_key.pem -outform DER -out private_rsa_key.der`
## Converting private DER to PEM
`openssl rsa -in private_rsa_key.der -inform DER -outform PEM -out private_rsa_key.pem`
## Generating public key
`openssl rsa -in private_rsa_key.der -inform DER -RSAPublicKey_out -outform DER -out public_key.der`

View File

@ -0,0 +1,8 @@
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAyRE6rHuNR0QbHO3H3Kt2pOKGVhQqGZXInOduQNxXzuKlvQTLUTv4
l4sggh5/CYYi/cvI+SXVT9kPWSKXxJXBXd/4LkvcPuUakBoAkfh+eiFVMh2VrUyW
yj3MFl0HTVF9KwRXLAcwkREiS3npThHRyIxuy0ZMeZfxVL5arMhw1SRELB8HoGfG
/AtH89BIE9jDBHZ9dLelK9a184zAf8LwoPLxvJb3Il5nncqPcSfKDDodMFBIMc4l
QzDKL5gvmiXLXB1AGLm8KBjfE8s3L5xqi+yUod+j8MtvIj812dkS4QMiRVN/by2h
3ZY8LYVGrqZXZTcgn2ujn8uKjXLZVD5TdQIDAQAB
-----END RSA PUBLIC KEY-----