forked from External/grumble
Update for Go 1.
This commit is contained in:
parent
4114a83d64
commit
e46a65109f
31 changed files with 901 additions and 202 deletions
|
|
@ -21,14 +21,15 @@ import (
|
|||
// certificate. Output PEM-encoded DER representations of the resulting
|
||||
// certificate and private key to certpath and keypath.
|
||||
func GenerateSelfSignedCert(certpath, keypath string) (err error) {
|
||||
now := time.Seconds()
|
||||
now := time.Now()
|
||||
tmpl := &x509.Certificate{
|
||||
SerialNumber: big.NewInt(0),
|
||||
Subject: pkix.Name{
|
||||
CommonName: "Grumble Autogenerated Certificate",
|
||||
},
|
||||
NotBefore: time.SecondsToUTC(now - 300),
|
||||
NotAfter: time.SecondsToUTC(now + 60*60*24*365), // valid for 1 year.
|
||||
NotBefore: now.Add(-300 * time.Second),
|
||||
// Valid for 1 year.
|
||||
NotAfter: now.Add(24 * time.Hour * 365),
|
||||
|
||||
SubjectKeyId: []byte{1, 2, 3, 4},
|
||||
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue