2019-02-22 17:35:49 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-10-16 11:09:29 +02:00
|
|
|
"forge.cadoles.com/Cadoles/go-http-peering/crypto"
|
2019-02-22 17:35:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
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))
|
|
|
|
}
|