gemcert

package
v0.0.0-...-d471ebf Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: ISC Imports: 14 Imported by: 0

Documentation

Overview

Package gemcert provides utilities for creating certificates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateX509KeyPair

func CreateX509KeyPair(options CreateOptions) (tls.Certificate, error)

CreateX509KeyPair creates a new TLS certificate.

func Fingerprint

func Fingerprint(cert *x509.Certificate) string

Fingerprint returns the hexadecimal encoding of the sha256 hash of the given certificate's Subject Public Key Info (SPKI) section.

func LoadX509KeyPair

func LoadX509KeyPair(certFile, keyFile string) (cert tls.Certificate, err error)

LoadX509KeyPair reads and parses a public/private key pair from a pair of files. The files must be PEM encoded. Certificate.Leaf will contain the parsed form of the certificate.

func StoreX509KeyPair

func StoreX509KeyPair(cert tls.Certificate, certFile, keyFile string) error

StoreX509KeyPair stores the public and private keys of the provided certificate in their respective files.

Types

type CreateOptions

type CreateOptions struct {
	// DNSNames should contain the DNS names that this certificate is valid for.
	DNSNames []string

	// IPAdresses Should contain the IP addresses that the certificate is valid for.
	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 time.Duration

	// Rand sets the random number generator.
	// If nil, crypto/rand.Reader is used.
	Rand io.Reader

	// Parent is the optional certificate to sign with.
	// If nil, the certificate will be self-signed.
	Parent *x509.Certificate
}

CreateOptions configures the creation of a TLS certificate generated with the Ed25519 signature algorithm.

Jump to

Keyboard shortcuts

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