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

24 lines
407 B
Go

package main
import (
"fmt"
"forge.cadoles.com/wpetit/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))
}