go-gemini/examples/cert.go

25 lines
328 B
Go
Raw Normal View History

2020-10-12 20:34:52 +00:00
// +build ignore
2020-09-27 17:50:48 +00:00
package main
import (
"log"
2020-09-28 03:49:41 +00:00
"time"
2020-09-27 17:50:48 +00:00
2020-09-28 22:19:59 +00:00
"git.sr.ht/~adnano/gmi"
2020-09-27 17:50:48 +00:00
)
func main() {
host := "localhost"
duration := 2 * time.Minute
2020-09-28 03:49:41 +00:00
crt, key, err := gmi.NewRawCertificate(host, duration)
2020-09-27 17:50:48 +00:00
if err != nil {
log.Fatal(err)
}
if err := gmi.WriteX509KeyPair(host, crt, key); err != nil {
2020-09-27 17:50:48 +00:00
log.Fatal(err)
}
}