certificate: Remove Subject from CreateOptions
This commit is contained in:
parent
688e7e2823
commit
ce649ecc66
@ -9,7 +9,6 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
@ -28,13 +27,6 @@ type CreateOptions struct {
|
|||||||
// Should contain the IP addresses that the certificate is valid for.
|
// Should contain the IP addresses that the certificate is valid for.
|
||||||
IPAddresses []net.IP
|
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 specifies the amount of time that the certificate is valid for.
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
|
|
||||||
@ -100,7 +92,6 @@ func newX509KeyPair(options CreateOptions) (*x509.Certificate, crypto.PrivateKey
|
|||||||
BasicConstraintsValid: true,
|
BasicConstraintsValid: true,
|
||||||
IPAddresses: options.IPAddresses,
|
IPAddresses: options.IPAddresses,
|
||||||
DNSNames: options.DNSNames,
|
DNSNames: options.DNSNames,
|
||||||
Subject: options.Subject,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
crt, err := x509.CreateCertificate(rand.Reader, &template, &template, pub, priv)
|
crt, err := x509.CreateCertificate(rand.Reader, &template, &template, pub, priv)
|
||||||
|
@ -3,7 +3,6 @@ package certificate
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@ -170,9 +169,6 @@ func (s *Store) createCertificate(scope string) (tls.Certificate, error) {
|
|||||||
}
|
}
|
||||||
return Create(CreateOptions{
|
return Create(CreateOptions{
|
||||||
DNSNames: []string{scope},
|
DNSNames: []string{scope},
|
||||||
Subject: pkix.Name{
|
|
||||||
CommonName: scope,
|
|
||||||
},
|
|
||||||
Duration: 365 * 24 * time.Hour,
|
Duration: 365 * 24 * time.Hour,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/x509/pkix"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -25,9 +24,6 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
options := certificate.CreateOptions{
|
options := certificate.CreateOptions{
|
||||||
Subject: pkix.Name{
|
|
||||||
CommonName: host,
|
|
||||||
},
|
|
||||||
DNSNames: []string{host},
|
DNSNames: []string{host},
|
||||||
Duration: duration,
|
Duration: duration,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user