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