Remove ski creds specific code

This commit is contained in:
Melon 2022-03-13 10:22:53 +00:00
parent c86bc8d7e1
commit ea5b79d8d8
Signed by: melon
GPG Key ID: B0ADD5395BCDAAB6
3 changed files with 12 additions and 28 deletions

12
ca.go
View File

@ -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,

View File

@ -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},

View File

@ -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},