iris/_examples/miscellaneous/jwt
Gerasimos (Makis) Maropoulos d556cfc39a New builtin JWT middleware - this one supports encryption and ed25519
Former-commit-id: ca20d256b766e3e8717e91de7a3f3b5f213af0bc
2020-05-27 12:02:17 +03:00
..
main.go New builtin JWT middleware - this one supports encryption and ed25519 2020-05-27 12:02:17 +03:00
private_rsa.pem New builtin JWT middleware - this one supports encryption and ed25519 2020-05-27 12:02:17 +03:00
README.md New builtin JWT middleware - this one supports encryption and ed25519 2020-05-27 12:02:17 +03:00

Generate RSA

$ openssl genrsa -des3 -out private_rsa.pem 2048
b, err := ioutil.ReadFile("./private_rsa.pem")
if err != nil {
    panic(err)
}
key := jwt.MustParseRSAPrivateKey(b, []byte("pass"))

OR

import "crypto/rand"
import "crypto/rsa"

key, err := rsa.GenerateKey(rand.Reader, 2048)

Generate Ed25519

$ openssl genpkey -algorithm Ed25519 -out private_ed25519.pem
$ openssl req -x509 -key private_ed25519.pem -out cert_ed25519.pem -days 365