go-gemini/examples/cert.go

25 lines
333 B
Go
Raw Normal View History

2020-10-12 14:34:52 -06:00
// +build ignore
2020-09-27 11:50:48 -06:00
package main
import (
"log"
2020-09-27 21:49:41 -06:00
"time"
2020-09-27 11:50:48 -06:00
2020-09-28 16:19:59 -06:00
"git.sr.ht/~adnano/gmi"
2020-09-27 11:50:48 -06:00
)
func main() {
host := "localhost"
2020-09-27 21:49:41 -06:00
duration := 365 * 24 * time.Hour
crt, key, err := gmi.NewRawCertificate(host, duration)
2020-09-27 11:50:48 -06:00
if err != nil {
log.Fatal(err)
}
if err := gmi.WriteX509KeyPair(host, crt, key); err != nil {
2020-09-27 11:50:48 -06:00
log.Fatal(err)
}
}