From ea5b79d8d86f0ecfb6576b0a8d633e4fde192bd7 Mon Sep 17 00:00:00 2001 From: MrMelon Date: Sun, 13 Mar 2022 10:22:53 +0000 Subject: [PATCH] Remove ski creds specific code --- ca.go | 12 +++--------- client.go | 12 +++--------- server.go | 16 ++++++---------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/ca.go b/ca.go index 3057b07..a047783 100644 --- a/ca.go +++ b/ca.go @@ -11,16 +11,10 @@ import ( "time" ) -func MakeCaTls() (*CertGen, error) { +func MakeCaTls(name pkix.Name, serialNumber *big.Int) (*CertGen, error) { ca := &x509.Certificate{ - SerialNumber: big.NewInt(29052019), - Subject: pkix.Name{ - Organization: []string{"Ski Creds CA"}, - Country: []string{"GB"}, - Province: []string{""}, - Locality: []string{"London"}, - CommonName: "ski-creds-ca", - }, + SerialNumber: serialNumber, + Subject: name, NotBefore: time.Now(), NotAfter: time.Now().AddDate(10, 0, 0), IsCA: true, diff --git a/client.go b/client.go index 62d41ca..13e2313 100644 --- a/client.go +++ b/client.go @@ -11,16 +11,10 @@ import ( "time" ) -func MakeClientTls() (*CertGen, error) { +func MakeClientTls(name pkix.Name, serialNumber *big.Int) (*CertGen, error) { cert := &x509.Certificate{ - SerialNumber: big.NewInt(29052019), - Subject: pkix.Name{ - Organization: []string{"Ski Creds Client"}, - Country: []string{"GB"}, - Province: []string{""}, - Locality: []string{"London"}, - CommonName: "ski-creds-client", - }, + SerialNumber: serialNumber, + Subject: name, NotBefore: time.Now(), NotAfter: time.Now().AddDate(10, 0, 0), SubjectKeyId: []byte{1, 2, 3, 4, 6}, diff --git a/server.go b/server.go index 6525273..9587a95 100644 --- a/server.go +++ b/server.go @@ -8,20 +8,16 @@ import ( "crypto/x509/pkix" "log" "math/big" + "net" "time" ) -func MakeServerTls(ca *CertGen) (*CertGen, error) { +func MakeServerTls(ca *CertGen, name pkix.Name, serialNumber *big.Int, dnsNames []string, ipAddresses []net.IP) (*CertGen, error) { cert := &x509.Certificate{ - SerialNumber: big.NewInt(29052019), - Subject: pkix.Name{ - Organization: []string{"Ski Creds Server"}, - Country: []string{"GB"}, - Province: []string{""}, - Locality: []string{"London"}, - CommonName: "ski-creds-server", - }, - DNSNames: []string{"panda.local"}, + SerialNumber: serialNumber, + Subject: name, + DNSNames: dnsNames, + IPAddresses: ipAddresses, NotBefore: time.Now(), NotAfter: time.Now().AddDate(10, 0, 0), SubjectKeyId: []byte{1, 2, 3, 4, 6},