Documentation ¶
Index ¶
- func NewClientCert(key, rootKey *rsa.PrivateKey, rootCert *x509.Certificate, subject pkix.Name, ...) (*x509.Certificate, error)
- func NewPrivateKey(bits int, w io.Writer) (*rsa.PrivateKey, error)
- func NewRootCert(key *rsa.PrivateKey, subject pkix.Name, ttl time.Time, w io.Writer) (*x509.Certificate, error)
- func NewServerCert(key, rootKey *rsa.PrivateKey, rootCert *x509.Certificate, subject pkix.Name, ...) (*x509.Certificate, error)
- func OpenCertificate(name string) (*x509.Certificate, error)
- func OpenPrivateKey(name string) (*rsa.PrivateKey, error)
- type DN
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientCert ¶
func NewClientCert(key, rootKey *rsa.PrivateKey, rootCert *x509.Certificate, subject pkix.Name, ttl time.Time, w io.Writer, host ...string) (*x509.Certificate, error)
func NewPrivateKey ¶
NewPrivateKey will create a new private key of the given bits size, If the second argument is not nil a pem encoded block of the generated key wil be writer to that writer.
func NewRootCert ¶
func NewRootCert(key *rsa.PrivateKey, subject pkix.Name, ttl time.Time, w io.Writer) (*x509.Certificate, error)
NewRootCert will generate a new CA cert that will be used to sign and authenticate client and servers, a pem encoded block will be written to the given writer (is it is not nil).
func NewServerCert ¶
func NewServerCert(key, rootKey *rsa.PrivateKey, rootCert *x509.Certificate, subject pkix.Name, ttl time.Time, w io.Writer, host ...string) (*x509.Certificate, error)
func OpenCertificate ¶
func OpenCertificate(name string) (*x509.Certificate, error)
OpenCertificate opem PEM encoded certificate file and decode data
func OpenPrivateKey ¶
func OpenPrivateKey(name string) (*rsa.PrivateKey, error)
OpenPrivateKey reads the source file and return the private key. The source file should be contain a pem encoded private key.
Types ¶
type DN ¶
type DN struct { CN string SERIALNUMBER string UID string SN []string C []string L []string STREET []string POSTALCODE []string ST []string O []string OU []string TITLE []string G []string DC []string }
DN represents an X.509 distinguished name. It can read or copy values to a pkix.Name object that can be used for creating a certificate. The main deference between a pkix.Name and DN is that the DN can also read from a string and write to string (ReadString and String methods)
func (*DN) ReadPkixName ¶
ReadPkixName will copy the values from a pkix.Name to this instance