certutil

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCACrt []byte
View Source
var DefaultCAKey []byte
View Source
var DefaultDNSNames = []string{"localhost"}
View Source
var DefaultDuration = time.Hour * 24 * 365 * 10
View Source
var DefaultIPAddresses = []net.IP{net.IPv4(127, 0, 0, 1), net.IPv6loopback}
View Source
var DefaultName = &pkix.Name{
	Organization:  []string{"University Library Basel"},
	Country:       []string{"CH"},
	Province:      []string{"Basel City"},
	Locality:      []string{"Basel"},
	StreetAddress: []string{"Schönbeinstrasse 18-20"},
	PostalCode:    []string{"4056"},
}

Functions

func CertificateFromPEM

func CertificateFromPEM(certPEM []byte) (*x509.Certificate, error)

func CertificateKeyFromPEM

func CertificateKeyFromPEM(certPEM, keyPEM, password []byte) (*x509.Certificate, any, error)

func CreateCA

func CreateCA(duration time.Duration, name *pkix.Name, keyType KeyType) (caPEM []byte, caPrivKeyPEM []byte, err error)

func CreateCertificate

func CreateCertificate(client, server bool, duration time.Duration, ca *x509.Certificate, caPrivKey any, ips []net.IP, dnsNames []string, email, uri []string, name *pkix.Name, keyType KeyType) (certPEM []byte, certPrivKeyPEM []byte, err error)

func DecryptPrivateKey

func DecryptPrivateKey(data, password []byte) ([]byte, error)

func EncryptPrivateKey

func EncryptPrivateKey(data, password []byte) ([]byte, error)

func GenerateKey

func GenerateKey(keyType KeyType) (pub any, priv any, err error)

func GeneratePassword

func GeneratePassword(length int) (string, error)

func KeyFromPEM

func KeyFromPEM(keyPEM, password []byte) (any, error)

func PEMKeyType

func PEMKeyType(priv any) string

Types

type KeyType

type KeyType string
const (
	ED25519   KeyType = "ed25519"
	RSA2048   KeyType = "rsa2048"
	RSA3072   KeyType = "rsa3072"
	RSA4096   KeyType = "rsa4096"
	ECDSAP224 KeyType = "ecdsaP224"
	ECDSAP256 KeyType = "ecdsaP256"
	ECDSAP384 KeyType = "ecdsaP384"
	ECDSAP521 KeyType = "ecdsaP521"
)
var DefaultKeyType KeyType = ECDSAP384

Jump to

Keyboard shortcuts

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