pki

package
v0.0.0-...-8f55651 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCrtAlgo       = RSA
	UnsupportedAlgorithm = ""
	EDDSA                = "eddsa"
	ECDSA                = "ecdsa"
	RSA                  = "rsa"
)
View Source
const DefaultCrtDuration = time.Duration(397 * 24 * time.Hour)

Variables

View Source
var DomainRegex = regexp.MustCompile(`^[*\.]{0,2}(?:(?:[\*a-z][a-z0-9-]+)\.)+[a-z]{2,}$`)

Functions

func AltNames

func AltNames(crt *x509.Certificate) ([]string, []string)

func Export

func Export(block *pem.Block, path string) (err error)

func ExportBytes

func ExportBytes(block *pem.Block) []byte

func IsValidCN

func IsValidCN(name string) bool

func Parse

func Parse(path string) (*x509.Certificate, error)

func ParseAltNames

func ParseAltNames(altNames []string) (dnsNames, ipAddresses []string)

func ParseBytes

func ParseBytes(data []byte) (*x509.Certificate, error)

func Wrap

func Wrap(crt *x509.Certificate, key *Key, ca *x509.Certificate, signer *Key) (*pem.Block, *pem.Block, error)

func WrapCrt

func WrapCrt(crt *x509.Certificate, key *Key, ca *x509.Certificate, signer *Key) (*pem.Block, error)

func WrapKey

func WrapKey(key *Key) (*pem.Block, error)

Types

type Key

type Key struct {
	Value any
	Algo  string
}

func New

func New(req Request) (*x509.Certificate, *Key, error)

func ParseKey

func ParseKey(path string) (*Key, error)

func ParseKeyPair

func ParseKeyPair(crtPath, keyPath string) (*x509.Certificate, *Key, error)

func ParseKeyPairBytes

func ParseKeyPairBytes(crt, key []byte) (*x509.Certificate, *Key, error)

func (*Key) Public

func (key *Key) Public() any

type Request

type Request struct {
	Organization  string
	Country       string
	Province      string
	Locality      string
	StreetAddress string
	PostalCode    string
	CN            string
	DNSNames      []string
	IPAddresses   []string
	CA            bool
	Algo          string
	Duration      time.Duration
}

func NewRequest

func NewRequest(options map[string]any) Request

Jump to

Keyboard shortcuts

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