aboutsummaryrefslogtreecommitdiff
path: root/examples/cert.go
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cert.go')
-rw-r--r--examples/cert.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/cert.go b/examples/cert.go
new file mode 100644
index 0000000..4c08578
--- /dev/null
+++ b/examples/cert.go
@@ -0,0 +1,24 @@
+// +build ignore
+
+package main
+
+import (
+ "log"
+ "time"
+
+ "git.sr.ht/~adnano/gmi"
+)
+
+func main() {
+ host := "localhost"
+
+ duration := 365 * 24 * time.Hour
+ crt, key, err := gmi.NewRawCertificate(host, duration)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ if err := gmi.WriteX509KeyPair(host, crt, key); err != nil {
+ log.Fatal(err)
+ }
+}