mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 03:01:03 +01:00
ed45c77be5
Former-commit-id: ed635ee95de7160cde11eaabc0c1dcb0e460a620
30 lines
493 B
Markdown
30 lines
493 B
Markdown
# Generate RSA
|
|
|
|
```sh
|
|
$ openssl genrsa -des3 -out private_rsa.pem 2048
|
|
```
|
|
|
|
```go
|
|
b, err := ioutil.ReadFile("./private_rsa.pem")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
key := jwt.MustParseRSAPrivateKey(b, []byte("pass"))
|
|
```
|
|
|
|
OR
|
|
|
|
```go
|
|
import "crypto/rand"
|
|
import "crypto/rsa"
|
|
|
|
key, err := rsa.GenerateKey(rand.Reader, 2048)
|
|
```
|
|
|
|
# Generate Ed25519
|
|
|
|
```sh
|
|
$ openssl genpkey -algorithm Ed25519 -out private_ed25519.pem
|
|
$ openssl req -x509 -key private_ed25519.pem -out cert_ed25519.pem -days 365
|
|
```
|