1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-05-06 08:46:15 +02:00

certificate: Remove Subject from CreateOptions

This commit is contained in:
Adnan Maolood 2021-03-04 16:27:16 -05:00
parent 688e7e2823
commit ce649ecc66
3 changed files with 0 additions and 17 deletions

View File

@ -9,7 +9,6 @@ import (
"crypto/rand"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"math/big"
"net"
@ -28,13 +27,6 @@ type CreateOptions struct {
// Should contain the IP addresses that the certificate is valid for.
IPAddresses []net.IP
// Subject specifies the certificate Subject.
//
// Subject.CommonName can contain the DNS name that this certificate
// is valid for. Server certificates should specify both a Subject
// and a Subject Alternate Name.
Subject pkix.Name
// Duration specifies the amount of time that the certificate is valid for.
Duration time.Duration
@ -100,7 +92,6 @@ func newX509KeyPair(options CreateOptions) (*x509.Certificate, crypto.PrivateKey
BasicConstraintsValid: true,
IPAddresses: options.IPAddresses,
DNSNames: options.DNSNames,
Subject: options.Subject,
}
crt, err := x509.CreateCertificate(rand.Reader, &template, &template, pub, priv)

View File

@ -3,7 +3,6 @@ package certificate
import (
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"errors"
"fmt"
"io/fs"
@ -170,9 +169,6 @@ func (s *Store) createCertificate(scope string) (tls.Certificate, error) {
}
return Create(CreateOptions{
DNSNames: []string{scope},
Subject: pkix.Name{
CommonName: scope,
},
Duration: 365 * 24 * time.Hour,
})
}

View File

@ -5,7 +5,6 @@
package main
import (
"crypto/x509/pkix"
"fmt"
"log"
"os"
@ -25,9 +24,6 @@ func main() {
log.Fatal(err)
}
options := certificate.CreateOptions{
Subject: pkix.Name{
CommonName: host,
},
DNSNames: []string{host},
Duration: duration,
}