blob: 93c06778e299b321655f4803f64f208c2df9a3a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package main
import (
"flag"
)
func CreatePublicKey(args []string) error {
fs := flag.NewFlagSet("pkictl create-public-key", flag.ExitOnError)
flagPrivate := fs.String("private-key", "", "path to the private key or read from stdin")
flagOutput := fs.String("output", "stdout", "write private key to file")
fs.Parse(args)
pk, err := loadPrivateKey(*flagPrivate)
if err != nil {
return err
}
out, err := openOutput(*flagOutput)
if err != nil {
return err
}
defer out.Close()
pub := pk.Public()
return writePem(pub, out)
}
|