go-http-peering/cmd/keygen/create_key.go

24 lines
408 B
Go

package main
import (
"fmt"
"forge.cadoles.com/Cadoles/go-http-peering/crypto"
)
func createKey() {
passphrase, err := getPassphrase()
if err != nil {
handleError(err)
}
key, err := crypto.CreateRSAKey(keySize)
if err != nil {
handleError(err)
}
privatePEM, err := crypto.EncodePrivateKeyToEncryptedPEM(key, passphrase)
if err != nil {
handleError(err)
}
fmt.Print(string(privatePEM))
}