crtutil

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package crtutil is common certificate related utils for Go.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownKeyType = errors.New("unknown private key type in PKCS#8 wrapping")
)

Functions

func EncodeX509ChainToPEM added in v0.1.23

func EncodeX509ChainToPEM(chain []*x509.Certificate, headers map[string]string) ([]byte, error)

EncodeX509ChainToPEM converts a slice of x509.Certificate into PEM block, in the order they are passed.

func EncodeX509ToPEM added in v0.1.23

func EncodeX509ToPEM(cert *x509.Certificate, headers map[string]string) []byte

EncodeX509ToPEM converts a x509.Certificate into a PEM block.

func IsSelfSigned added in v0.1.25

func IsSelfSigned(cert *x509.Certificate) bool

IsSelfSigned whether the given x509.Certificate is self-signed.

func ReadAsSigner added in v0.1.25

func ReadAsSigner(data []byte, isBase64 bool) (crypto.PrivateKey, error)

ReadAsSigner read a crypto.PrivateKey from the given data.

func ReadAsSignerFromFile added in v0.1.25

func ReadAsSignerFromFile(fpath string) (crypto.PrivateKey, error)

ReadAsSignerFromFile read a crypto.PrivateKey from the given file.

func ReadAsSignerWithPassFromFile added in v0.1.25

func ReadAsSignerWithPassFromFile(keyPath, keyPass string) (crypto.PrivateKey, error)

ReadAsSignerWithPassFromFile read a crypto.PrivateKey from the given file.

func ReadAsX509 added in v0.1.25

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

ReadAsX509 read x509.Certificate chain from the given data. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE".

func ReadAsX509FromFile added in v0.1.25

func ReadAsX509FromFile(fpath string) ([]*x509.Certificate, error)

ReadAsX509FromFile read x509.Certificate from the given file. The data is expected to be PEM Encoded and contain one or more certificates with PEM type "CERTIFICATE".

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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