internal

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Overview

Package internal holds the internal details of creating a self-signed certificate from either a Root CA or individual cert.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCertificateAndPrivateKey

func CreateCertificateAndPrivateKey(params *Params) ([]byte, []byte, error)

CreateCertificateAndPrivateKey returns the public certificate and private key pair as byte arrays.

func CreateCertificateAndPrivateKeyFiles

func CreateCertificateAndPrivateKeyFiles(publicCertificateFilePath string, privateKeyFilePath string, params *Params) error

CreateCertificateAndPrivateKeyFiles writes the random public certificate and private key pair to disk.

func ReadKeyPair

func ReadKeyPair(publicCertFileData []byte, privateKeyFileData []byte) (*x509.Certificate, *rsa.PrivateKey, error)

ReadKeyPair takes PEM-encoded public certificate/private key pairs and returns the Go classes for them so they can be used for encryption or signing.

Types

type Params

type Params struct {
	// If true, indicates that this certificate is a root certificate.
	// Root certificates are used to establish a chain of trust.
	// This means that if the root certificate is trusted certificates derived from it are also trusted.
	CertificateAuthority bool

	// (optional) Root certificate that will be used to create the new derived certificate from.
	RootPublicCertificateData []byte
	// (optional) Root private that will be used to create the new derived certificate from.
	RootPrivateKeyData []byte

	// The duration from now when the certificate will expire.
	ValidityDuration time.Duration
	// List of hostnames that this certificate is valid for. Clients verify that this
	Hostnames []string
	// RSA encryption key length.
	RSAKeyLength int
}

Params for creating an X.509 certificate and RSA private key pair for TLS.

Jump to

Keyboard shortcuts

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