Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyLocations ¶
type KeyLocations struct { KeyPath string // path to the generated pem-encoded RSA key CertPath string // path to the self-signed x509 certificate }
Return value of the GenerateKeyAndCertificate function containing the path to the generated key and certificate files.
type SelfSigner ¶
type SelfSigner struct { Country string Hosts []string // first host will be used as CN, all hosts will be added as SAN Locality string Organization string OrganizationUnit string RsaKeyBits int // default: 2048 ValidFor time.Duration // duraation after ValidFrom the certificate will be valid ValidFrom time.Time // earliest date for certificate validity }
Struct containing parameters for key and certificate generation
func NewSelfSigner ¶
func NewSelfSigner() *SelfSigner
Create a new SelfSigner struct with dummy values
Example ¶
package main import ( "net/http" "github.com/joshrivers/selfsignedcertgen" ) func main() { keyLocations := selfsignedcertgen.NewSelfSigner().GenerateKeyAndCertificate() http.ListenAndServeTLS(":443", keyLocations.CertPath, keyLocations.KeyPath, nil) }
Output:
func (SelfSigner) GenerateKeyAndCertificate ¶
func (ss SelfSigner) GenerateKeyAndCertificate() KeyLocations
Generates a key and certificate from SelfSigner spec and stores them in temporary files. Returns a struct containing the path to the generated temporary files.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.