Documentation
¶
Index ¶
- Variables
- func GeneratePrivateKeyAndSerialNumber() (*rsa.PrivateKey, *big.Int, error)
- func GenerateSerialNumber() (*big.Int, error)
- type TestCertAndKey
- func GenerateClientTestKeyAndCert(commonName string, parent *TestCertAndKey) (*TestCertAndKey, error)
- func GenerateClientTestKeyAndCertWithDate(commonName string, parent *TestCertAndKey, notBefore time.Time) (*TestCertAndKey, error)
- func GenerateClientTestKeyAndCertWithOU(commonName, organization, organizationalUnit string, parent *TestCertAndKey) (*TestCertAndKey, error)
- func GenerateRootSigningCert(commonName string, organizationalUnit []string) (*TestCertAndKey, error)
- func GenerateServerTestKeyAndCert(commonName string, sanDomains []string, sanIPs []string, ...) (*TestCertAndKey, error)
- func GenerateServerTestKeyAndCertWithDate(commonName string, sanDomains []string, sanIPs []string, ...) (*TestCertAndKey, error)
Constants ¶
This section is empty.
Variables ¶
var (
// CertValidity 5 years in hours
CertValidity = 5 * 365 * 24
)
Functions ¶
func GeneratePrivateKeyAndSerialNumber ¶
func GeneratePrivateKeyAndSerialNumber() (*rsa.PrivateKey, *big.Int, error)
GeneratePrivateKeyAndSerialNumber generates a private key and serial number
func GenerateSerialNumber ¶
GenerateSerialNumber creates a serial number.
Types ¶
type TestCertAndKey ¶
type TestCertAndKey struct { CertFile string KeyFile string Cert *x509.Certificate // contains filtered or unexported fields }
TestCertAndKey is a struct to store cert info.
func GenerateClientTestKeyAndCert ¶
func GenerateClientTestKeyAndCert(commonName string, parent *TestCertAndKey) (*TestCertAndKey, error)
GenerateClientTestKeyAndCert generates a test client cert/key given a signing CA
func GenerateClientTestKeyAndCertWithDate ¶
func GenerateClientTestKeyAndCertWithDate(commonName string, parent *TestCertAndKey, notBefore time.Time) (*TestCertAndKey, error)
GenerateClientTestKeyAndCertWithDate generates a test client cert/key given a signing CA give a start date
func GenerateClientTestKeyAndCertWithOU ¶
func GenerateClientTestKeyAndCertWithOU(commonName, organization, organizationalUnit string, parent *TestCertAndKey) (*TestCertAndKey, error)
GenerateClientTestKeyAndCertWithOU generates a test client cert/key given a signing CA
func GenerateRootSigningCert ¶
func GenerateRootSigningCert(commonName string, organizationalUnit []string) (*TestCertAndKey, error)
GenerateRootSigningCert generates cert and key for a signing CA
func GenerateServerTestKeyAndCert ¶
func GenerateServerTestKeyAndCert(commonName string, sanDomains []string, sanIPs []string, parent *TestCertAndKey) (*TestCertAndKey, error)
GenerateServerTestKeyAndCert generates a test server cert/key given a signing CA.
func GenerateServerTestKeyAndCertWithDate ¶
func GenerateServerTestKeyAndCertWithDate(commonName string, sanDomains []string, sanIPs []string, parent *TestCertAndKey, notBefore time.Time) (*TestCertAndKey, error)
GenerateServerTestKeyAndCertWithDate generates a test server cert/key given a signing CA and given validity date
func (*TestCertAndKey) SaveCerts ¶
func (t *TestCertAndKey) SaveCerts(directory, name string)
SaveCerts stores cert and key files into a given dir.