certificates

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCertReq

func CreateCertReq(opts *CertOptions, privateKey *rsa.PrivateKey) (*x509.CertificateRequest, error)

CreateCertReq creates a new x.509 certificate request for an existing private key.

func CreateCertReqWithKey

func CreateCertReqWithKey(opts *CertOptions) (*x509.CertificateRequest, *rsa.PrivateKey, error)

CreateCertReqWithKey creates a new x.509 certificate request with a newly generated private key.

func InitCA

func InitCA(opts *CertOptions, certOut, keyOut string) error

func LoadCertificate

func LoadCertificate(filename string) (*x509.Certificate, error)

LoadCertificate loads a single certificate from a file.

func LoadFromPEMFile

func LoadFromPEMFile(filename string) ([]interface{}, error)

LoadFromPEMFile loads certificate data from a PEM file.

func LoadPrivateKey

func LoadPrivateKey(filename string) (*rsa.PrivateKey, error)

LoadPrivateKey loads a single RSA private key from a file.

func LoadPublicKey

func LoadPublicKey(filename string) (*rsa.PublicKey, error)

LoadPublicKey loads a single RSA public key from a file.

func LoadRequest

func LoadRequest(filename string) (*x509.CertificateRequest, error)

LoadRequest loads a single certificate request from a file.

func MakeReq

func MakeReq(opts *CertOptions, keyIn, keyOut, reqOut string) error

func SaveToPEMFile

func SaveToPEMFile(filename string, data []interface{}) error

SaveToPEMFile saves certificate data to a PEM file.

func SignCertReq

func SignCertReq(req *x509.CertificateRequest, ca *CA, opts *CertOptions) (*x509.Certificate, error)

SignCertReq signs a certificate request using a CA key.

func SignReq

func SignReq(opts *CertOptions, caCrtPath, caKeyPath, reqPath, certOut string, verify bool) error

Types

type CA

type CA struct {
	Certificate *x509.Certificate
	PrivateKey  *rsa.PrivateKey
}

CA contains internal data for a certificate authority.

func CreateCA

func CreateCA(opts *CertOptions) (*CA, error)

CreateCA initializes a new CertKeyPair from given parameters.

type CertNames

type CertNames struct {
	DNSNames    []string
	NodeIDs     []string
	IPAddresses []net.IP
}

CertNames lists the subjectAltNames that can be assigned to a certificate or request.

func GetReqNames

func GetReqNames(request *x509.CertificateRequest) (*CertNames, error)

GetReqNames returns the names coded into a certificate request, including Receptor node IDs.

type CertOptions

type CertOptions struct {
	CertNames
	CommonName string
	Bits       int
	NotBefore  time.Time
	NotAfter   time.Time
}

CertOptions are the parameters used to initialize a new certificate or request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL